You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ja...@apache.org on 2017/02/20 10:57:19 UTC
git commit: updated refs/heads/master to a3e6bce
Repository: cloudstack
Updated Branches:
refs/heads/master d7b792c3f -> a3e6bce8e
Revert "CLOUDSTACK-9711: Fixed error reporting while adding vpn user"
This reverts commit d7b792c3f91e8a3038d53a51fae700a158f92740.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a3e6bce8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a3e6bce8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a3e6bce8
Branch: refs/heads/master
Commit: a3e6bce8e626920f0a496f7971cb302a22233e40
Parents: d7b792c
Author: Jayapal <ja...@apache.org>
Authored: Mon Feb 20 16:26:45 2017 +0530
Committer: Jayapal <ja...@apache.org>
Committed: Mon Feb 20 16:26:45 2017 +0530
----------------------------------------------------------------------
api/src/com/cloud/network/vpn/RemoteAccessVpnService.java | 2 +-
.../cloudstack/api/command/user/vpn/AddVpnUserCmd.java | 8 ++------
.../cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java | 9 ++-------
.../com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java | 10 +---------
4 files changed, 6 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3e6bce8/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
index 5426d18..d089b85 100644
--- a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
+++ b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
@@ -43,7 +43,7 @@ public interface RemoteAccessVpnService {
List<? extends VpnUser> listVpnUsers(long vpnOwnerId, String userName);
- boolean applyVpnUsers(long vpnOwnerId, String userName) throws ResourceUnavailableException;
+ boolean applyVpnUsers(long vpnOwnerId, String userName);
Pair<List<? extends RemoteAccessVpn>, Integer> searchForRemoteAccessVpns(ListRemoteAccessVpnsCmd cmd);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3e6bce8/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java
index f6a30b3..9993102 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java
@@ -119,12 +119,8 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd {
public void execute() {
VpnUser vpnUser = _entityMgr.findById(VpnUser.class, getEntityId());
Account account = _entityMgr.findById(Account.class, vpnUser.getAccountId());
- try {
- if (!_ravService.applyVpnUsers(vpnUser.getAccountId(), userName)) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add vpn user");
- }
- }catch (Exception ex) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add vpn user due to resource unavailable");
+ if (!_ravService.applyVpnUsers(vpnUser.getAccountId(), userName)) {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add vpn user");
}
VpnUsersResponse vpnResponse = new VpnUsersResponse();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3e6bce8/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java
index 140bdad..f552b14 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java
@@ -115,14 +115,9 @@ public class RemoveVpnUserCmd extends BaseAsyncCmd {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove vpn user");
}
- try {
- if (!_ravService.applyVpnUsers(owner.getId(), userName)) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to apply vpn user removal");
- }
- }catch (Exception ex) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove vpn user due to resource unavailable");
+ if (!_ravService.applyVpnUsers(owner.getId(), userName)) {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to apply vpn user removal");
}
-
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3e6bce8/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
index 2e23474..065c097 100644
--- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
@@ -501,14 +501,13 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
@DB
@Override
- public boolean applyVpnUsers(long vpnOwnerId, String userName) throws ResourceUnavailableException {
+ public boolean applyVpnUsers(long vpnOwnerId, String userName) {
Account caller = CallContext.current().getCallingAccount();
Account owner = _accountDao.findById(vpnOwnerId);
_accountMgr.checkAccess(caller, null, true, owner);
s_logger.debug("Applying vpn users for " + owner);
List<RemoteAccessVpnVO> vpns = _remoteAccessVpnDao.findByAccount(vpnOwnerId);
- RemoteAccessVpnVO vpnTemp = null;
List<VpnUserVO> users = _vpnUsersDao.listByAccount(vpnOwnerId);
@@ -538,14 +537,12 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
} else {
finals[i] = false;
success = false;
- vpnTemp = vpn;
}
}
}
} catch (Exception e) {
s_logger.warn("Unable to apply vpn users ", e);
success = false;
- vpnTemp = vpn;
for (int i = 0; i < finals.length; i++) {
finals[i] = false;
@@ -578,11 +575,6 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
}
}
- if (!success) {
- throw new ResourceUnavailableException("Failed add vpn user due to Resource unavailable ",
- RemoteAccessVPNServiceProvider.class, vpnTemp.getId());
- }
-
return success;
}