You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sa...@apache.org on 2013/05/30 13:22:33 UTC
[02/50] [abbrv] git commit: updated refs/heads/vmware-storage-motion
to 406785b
CLOUDSTACK-2331: Failed to display exception object information in case of CloudRuntimeException.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6e557767
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6e557767
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6e557767
Branch: refs/heads/vmware-storage-motion
Commit: 6e55776795d2bf3c71f02ee8a38ad29e5d303f9d
Parents: 560fa52
Author: Min Chen <mi...@citrix.com>
Authored: Tue May 28 15:41:02 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Tue May 28 16:01:33 2013 -0700
----------------------------------------------------------------------
api/src/org/apache/cloudstack/api/BaseCmd.java | 2 +-
.../apache/cloudstack/api/ServerApiException.java | 3 +-
.../user/account/AddAccountToProjectCmd.java | 2 +-
.../user/snapshot/CreateSnapshotPolicyCmd.java | 2 +-
.../command/user/template/CreateTemplateCmd.java | 2 +-
.../cloudstack/api/response/ExceptionResponse.java | 12 ++-
server/src/com/cloud/api/ApiServer.java | 14 ++-
.../src/com/cloud/api/query/QueryManagerImpl.java | 2 +-
.../cloud/api/response/ApiResponseSerializer.java | 23 +++--
.../src/com/cloud/network/NetworkManagerImpl.java | 22 ++--
server/src/com/cloud/network/NetworkModelImpl.java | 19 +++-
.../src/com/cloud/network/NetworkServiceImpl.java | 82 +++++++-------
.../network/lb/LoadBalancingRulesManagerImpl.java | 27 +++--
.../com/cloud/network/rules/RulesManagerImpl.java | 12 +-
.../src/com/cloud/network/vpc/VpcManagerImpl.java | 16 ++-
.../src/com/cloud/projects/ProjectManagerImpl.java | 34 ++++--
.../com/cloud/resource/ResourceManagerImpl.java | 26 +++---
.../src/com/cloud/server/ManagementServerImpl.java | 65 +++++++-----
server/src/com/cloud/user/DomainManagerImpl.java | 10 +-
server/src/com/cloud/vm/UserVmManagerImpl.java | 34 +++---
.../lb/ApplicationLoadBalancerManagerImpl.java | 2 +-
.../utils/exception/CloudRuntimeException.java | 24 ++---
.../utils/exception/ExceptionProxyObject.java | 50 +++++++++
23 files changed, 299 insertions(+), 186 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index 9ac110c..219e7c7 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -521,7 +521,7 @@ public abstract class BaseCmd {
return project.getProjectAccountId();
} else {
PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the project with specified projectId in state=" + project.getState() + " as it's no longer active");
- ex.addProxyObject(project, projectId, "projectId");
+ ex.addProxyObject(project.getUuid(), "projectId");
throw ex;
}
} else {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/api/src/org/apache/cloudstack/api/ServerApiException.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ServerApiException.java b/api/src/org/apache/cloudstack/api/ServerApiException.java
index 4b0fae5..1a740d5 100644
--- a/api/src/org/apache/cloudstack/api/ServerApiException.java
+++ b/api/src/org/apache/cloudstack/api/ServerApiException.java
@@ -20,6 +20,7 @@ import java.util.ArrayList;
import com.cloud.exception.CloudException;
import com.cloud.utils.exception.CSExceptionErrorCode;
import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.exception.ExceptionProxyObject;
@SuppressWarnings("serial")
public class ServerApiException extends CloudRuntimeException {
@@ -45,7 +46,7 @@ public class ServerApiException extends CloudRuntimeException {
_description = description;
if (cause instanceof CloudRuntimeException) {
CloudRuntimeException rt = (CloudRuntimeException) cause;
- ArrayList<String> idList = rt.getIdProxyList();
+ ArrayList<ExceptionProxyObject> idList = rt.getIdProxyList();
if (idList != null) {
for (int i = 0; i < idList.size(); i++) {
addProxyObject(idList.get(i));
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
index ebc2272..58735f2 100644
--- a/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
@@ -101,7 +101,7 @@ public class AddAccountToProjectCmd extends BaseAsyncCmd {
//verify input parameters
if (project == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find project with specified id");
- ex.addProxyObject(project, getProjectId(), "projectId");
+ ex.addProxyObject(getProjectId().toString(), "projectId");
throw ex;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
index 5a9ea2a..14c2ee1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
@@ -112,7 +112,7 @@ public class CreateSnapshotPolicyCmd extends BaseCmd {
Project project = _projectService.findByProjectAccountId(volume.getAccountId());
if (project.getState() != Project.State.Active) {
PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the specified project id in state=" + project.getState() + " as it's no longer active");
- ex.addProxyObject(project, project.getId(), "projectId");
+ ex.addProxyObject(project.getUuid(), "projectId");
throw ex;
}
} else if (account.getState() == Account.State.disabled) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
index 6a482ac..6aa60ac 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
@@ -207,7 +207,7 @@ import java.util.Map;
Project project = _projectService.findByProjectAccountId(accountId);
if (project.getState() != Project.State.Active) {
PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the specified project id in state=" + project.getState() + " as it's no longer active");
- ex.addProxyObject(project, project.getId(), "projectId");
+ ex.addProxyObject(project.getUuid(), "projectId");
}
} else if (account.getState() == Account.State.disabled) {
throw new PermissionDeniedException("The owner of template is disabled: " + account);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java b/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java
index 3afd516..830cf00 100644
--- a/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java
@@ -17,16 +17,18 @@
package org.apache.cloudstack.api.response;
import java.util.ArrayList;
+import java.util.List;
import org.apache.cloudstack.api.BaseResponse;
import com.cloud.serializer.Param;
+import com.cloud.utils.exception.ExceptionProxyObject;
import com.google.gson.annotations.SerializedName;
public class ExceptionResponse extends BaseResponse {
@SerializedName("uuidList") @Param(description="List of uuids associated with this error")
- private ArrayList<String> idList;
+ private List<ExceptionProxyObject> idList;
@SerializedName("errorcode") @Param(description="numeric code associated with this error")
private Integer errorCode;
@@ -37,6 +39,10 @@ public class ExceptionResponse extends BaseResponse {
@SerializedName("errortext") @Param(description="the text associated with this error")
private String errorText = "Command failed due to Internal Server Error";
+ public ExceptionResponse(){
+ idList = new ArrayList<ExceptionProxyObject>();
+ }
+
public Integer getErrorCode() {
return errorCode;
}
@@ -53,12 +59,12 @@ public class ExceptionResponse extends BaseResponse {
this.errorText = errorText;
}
- public void addProxyObject(String id) {
+ public void addProxyObject(ExceptionProxyObject id) {
idList.add(id);
return;
}
- public ArrayList<String> getIdProxyList() {
+ public List<ExceptionProxyObject> getIdProxyList() {
return idList;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java
index 497be50..e748a35 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -148,6 +148,7 @@ import com.cloud.utils.concurrency.NamedThreadFactory;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.exception.ExceptionProxyObject;
@Component
public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiServerService {
@@ -387,9 +388,16 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ex.getMessage(), ex);
}
catch (PermissionDeniedException ex){
- ArrayList<String> idList = ex.getIdProxyList();
+ ArrayList<ExceptionProxyObject> idList = ex.getIdProxyList();
if (idList != null) {
- s_logger.info("PermissionDenied: " + ex.getMessage() + " on uuids: [" + StringUtils.listToCsvTags(idList) + "]");
+ StringBuffer buf = new StringBuffer();
+ for (ExceptionProxyObject obj : idList){
+ buf.append(obj.getDescription());
+ buf.append(":");
+ buf.append(obj.getUuid());
+ buf.append(" ");
+ }
+ s_logger.info("PermissionDenied: " + ex.getMessage() + " on objs: [" + buf.toString() + "]");
} else {
s_logger.info("PermissionDenied: " + ex.getMessage());
}
@@ -1067,7 +1075,7 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
apiResponse.setErrorCode(ex.getErrorCode().getHttpCode());
apiResponse.setErrorText(ex.getDescription());
apiResponse.setResponseName(responseName);
- ArrayList<String> idList = ex.getIdProxyList();
+ ArrayList<ExceptionProxyObject> idList = ex.getIdProxyList();
if (idList != null) {
for (int i=0; i < idList.size(); i++) {
apiResponse.addProxyObject(idList.get(i));
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index c586a7b..5a25732 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -2176,7 +2176,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
UserVmVO vmInstance = _userVmDao.findById(vmId);
if ((vmInstance == null) || (vmInstance.getRemoved() != null)) {
InvalidParameterValueException ex = new InvalidParameterValueException("unable to find a virtual machine with specified id");
- ex.addProxyObject(vmInstance, vmId, "vmId");
+ ex.addProxyObject(vmId.toString(), "vmId");
throw ex;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/server/src/com/cloud/api/response/ApiResponseSerializer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/response/ApiResponseSerializer.java b/server/src/com/cloud/api/response/ApiResponseSerializer.java
index 965660a..d2e5130 100644
--- a/server/src/com/cloud/api/response/ApiResponseSerializer.java
+++ b/server/src/com/cloud/api/response/ApiResponseSerializer.java
@@ -21,8 +21,10 @@ import com.cloud.api.ApiResponseGsonHelper;
import com.cloud.api.ApiServer;
import com.cloud.utils.encoding.URLEncoder;
import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.exception.ExceptionProxyObject;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
+
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.ResponseObject;
@@ -215,22 +217,27 @@ public class ApiResponseSerializer {
subObj.setObjectName(serializedName.value());
}
serializeResponseObjXML(sb, subObj);
- } else {
- // Only exception reponses carry a list of uuid
- // strings.
+ } else if (value instanceof ExceptionProxyObject) {
+ // Only exception reponses carry a list of
+ // ExceptionProxyObject objects.
+ ExceptionProxyObject idProxy = (ExceptionProxyObject) value;
// If this is the first IdentityProxy field
// encountered, put in a uuidList tag.
if (!usedUuidList) {
- sb.append("<").append(serializedName.value()).append(">");
+ sb.append("<" + serializedName.value() + ">");
usedUuidList = true;
}
- sb.append("<uuid>").append(value).append("</uuid>");
- // We have removed uuid property field due to removal of IdentityProxy class.
+ sb.append("<" + "uuid" + ">" + idProxy.getUuid() + "</" + "uuid" + ">");
+ // Append the new descriptive property also.
+ String idFieldName = idProxy.getDescription();
+ if (idFieldName != null) {
+ sb.append("<" + "uuidProperty" + ">" + idFieldName + "</" + "uuidProperty" + ">");
+ }
}
}
if (usedUuidList) {
- // close the uuidList.
- sb.append("</").append(serializedName.value()).append(">");
+ // close the uuidList.
+ sb.append("</").append(serializedName.value()).append(">");
}
} else if (fieldValue instanceof Date) {
sb.append("<").append(serializedName.value()).append(">").append(BaseCmd.getDateString((Date) fieldValue)).
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index fda0773..cc149a5 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -737,7 +737,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
// zone is of type DataCenter. See DataCenterVO.java.
PermissionDeniedException ex = new PermissionDeniedException("Cannot perform this operation, " +
"Zone is currently disabled");
- ex.addProxyObject("data_center", zone.getId(), "zoneId");
+ ex.addProxyObject(zone.getUuid(), "zoneId");
throw ex;
}
@@ -1483,8 +1483,8 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
if (errorIfAlreadySetup) {
InvalidParameterValueException ex = new InvalidParameterValueException("Found existing network configuration (with specified id) for offering (with specified id)");
- ex.addProxyObject(offering, offering.getId(), "offeringId");
- ex.addProxyObject(configs.get(0), configs.get(0).getId(), "networkConfigId");
+ ex.addProxyObject(offering.getUuid(), "offeringId");
+ ex.addProxyObject(configs.get(0).getUuid(), "networkConfigId");
throw ex;
} else {
return configs;
@@ -1500,8 +1500,8 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
if (errorIfAlreadySetup) {
InvalidParameterValueException ex = new InvalidParameterValueException("Found existing network configuration (with specified id) for offering (with specified id)");
- ex.addProxyObject(offering, offering.getId(), "offeringId");
- ex.addProxyObject(configs.get(0), configs.get(0).getId(), "networkConfigId");
+ ex.addProxyObject(offering.getUuid(), "offeringId");
+ ex.addProxyObject(configs.get(0).getUuid(), "networkConfigId");
throw ex;
} else {
return configs;
@@ -1553,7 +1553,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
if (networks.size() < 1) {
// see networkOfferingVO.java
CloudRuntimeException ex = new CloudRuntimeException("Unable to convert network offering with specified id to network profile");
- ex.addProxyObject(offering, offering.getId(), "offeringId");
+ ex.addProxyObject(offering.getUuid(), "offeringId");
throw ex;
}
@@ -1932,7 +1932,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
if (!element.implement(network, offering, dest, context)) {
CloudRuntimeException ex = new CloudRuntimeException("Failed to implement provider " + element.getProvider().getName() + " for network with specified id");
- ex.addProxyObject(network, network.getId(), "networkId");
+ ex.addProxyObject(network.getUuid(), "networkId");
throw ex;
}
}
@@ -2330,7 +2330,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
if (ntwkOff.getState() != NetworkOffering.State.Enabled) {
// see NetworkOfferingVO
InvalidParameterValueException ex = new InvalidParameterValueException("Can't use specified network offering id as its stat is not " + NetworkOffering.State.Enabled);
- ex.addProxyObject(ntwkOff, ntwkOff.getId(), "networkOfferingId");
+ ex.addProxyObject(ntwkOff.getUuid(), "networkOfferingId");
throw ex;
}
@@ -2339,7 +2339,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
// see PhysicalNetworkVO.java
InvalidParameterValueException ex = new InvalidParameterValueException("Specified physical network id is" +
" in incorrect state:" + pNtwk.getState());
- ex.addProxyObject("physical_network", pNtwk.getId(), "physicalNetworkId");
+ ex.addProxyObject(pNtwk.getUuid(), "physicalNetworkId");
throw ex;
}
@@ -2992,7 +2992,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
NetworkVO network = _networksDao.findById(networkId);
if (network == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Network with specified id doesn't exist");
- ex.addProxyObject(network, networkId, "networkId");
+ ex.addProxyObject(String.valueOf(networkId), "networkId");
throw ex;
}
@@ -3241,7 +3241,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
" network provision due to ", ex);
CloudRuntimeException e = new CloudRuntimeException("Failed to implement network (with specified id)" +
" elements and resources as a part of network provision for persistent network");
- e.addProxyObject(guestNetwork, guestNetwork.getId(), "networkId");
+ e.addProxyObject(guestNetwork.getUuid(), "networkId");
throw e;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/server/src/com/cloud/network/NetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java
index 010cb9d..f6bd646 100755
--- a/server/src/com/cloud/network/NetworkModelImpl.java
+++ b/server/src/com/cloud/network/NetworkModelImpl.java
@@ -37,9 +37,11 @@ import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
+import com.cloud.api.ApiDBUtils;
import com.cloud.configuration.Config;
import com.cloud.configuration.ConfigurationManager;
import com.cloud.configuration.dao.ConfigurationDao;
+import com.cloud.dc.DataCenter;
import com.cloud.dc.PodVlanMapVO;
import com.cloud.dc.Vlan;
import com.cloud.dc.Vlan.VlanType;
@@ -283,7 +285,12 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
} else {
CloudRuntimeException ex = new CloudRuntimeException("Multiple generic soure NAT IPs provided for network");
// see the IPAddressVO.java class.
- ex.addProxyObject("user_ip_address", ip.getAssociatedWithNetworkId(), "networkId");
+ IPAddressVO ipAddr = ApiDBUtils.findIpAddressById(ip.getAssociatedWithNetworkId());
+ String ipAddrUuid = ip.getAssociatedWithNetworkId().toString();
+ if ( ipAddr != null){
+ ipAddrUuid = ipAddr.getUuid();
+ }
+ ex.addProxyObject(ipAddrUuid, "networkId");
throw ex;
}
}
@@ -1129,17 +1136,21 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
public PhysicalNetwork getDefaultPhysicalNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType) {
List<PhysicalNetworkVO> networkList = _physicalNetworkDao.listByZoneAndTrafficType(zoneId, trafficType);
+ DataCenter dc = ApiDBUtils.findZoneById(zoneId);
+ String dcUuid = String.valueOf(zoneId);
+ if ( dc != null ){
+ dcUuid = dc.getUuid();
+ }
if (networkList.isEmpty()) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find the default physical network with traffic=" + trafficType + " in the specified zone id");
- // Since we don't have a DataCenterVO object at our disposal, we just set the table name that the zoneId's corresponding uuid is looked up from, manually.
- ex.addProxyObject("data_center", zoneId, "zoneId");
+ ex.addProxyObject(dcUuid, "zoneId");
throw ex;
}
if (networkList.size() > 1) {
InvalidParameterValueException ex = new InvalidParameterValueException("More than one physical networks exist in zone id=" + zoneId + " with traffic type=" + trafficType);
- ex.addProxyObject("data_center", zoneId, "zoneId");
+ ex.addProxyObject(dcUuid, "zoneId");
throw ex;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index 4eed735..9899284 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -65,6 +65,7 @@ import org.springframework.stereotype.Component;
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
import org.bouncycastle.util.IPAddress;
+import com.cloud.api.ApiDBUtils;
import com.cloud.configuration.Config;
import com.cloud.configuration.ConfigurationManager;
import com.cloud.configuration.dao.ConfigurationDao;
@@ -317,7 +318,12 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
} else {
CloudRuntimeException ex = new CloudRuntimeException("Multiple generic soure NAT IPs provided for network");
// see the IPAddressVO.java class.
- ex.addProxyObject("user_ip_address", ip.getAssociatedWithNetworkId(), "networkId");
+ IPAddressVO ipAddr = ApiDBUtils.findIpAddressById(ip.getAssociatedWithNetworkId());
+ String ipAddrUuid = ip.getAssociatedWithNetworkId().toString();
+ if ( ipAddr != null ){
+ ipAddrUuid = ipAddr.getUuid();
+ }
+ ex.addProxyObject(ipAddrUuid, "networkId");
throw ex;
}
}
@@ -877,7 +883,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
// don't allow releasing system ip address
if (ipVO.getSystem()) {
InvalidParameterValueException ex = new InvalidParameterValueException("Can't release system IP address with specified id");
- ex.addProxyObject(ipVO, ipVO.getId(), "systemIpAddrId");
+ ex.addProxyObject(ipVO.getUuid(), "systemIpAddrId");
throw ex;
}
@@ -994,12 +1000,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (ntwkOff == null || ntwkOff.isSystemOnly()) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find network offering by specified id");
if (ntwkOff != null) {
- ex.addProxyObject(ntwkOff, networkOfferingId, "networkOfferingId");
- // Get the VO object's table name.
- String tablename = AnnotationHelper.getTableName(ntwkOff);
- if (tablename != null) {
- ex.addProxyObject(tablename, networkOfferingId, "networkOfferingId");
- }
+ ex.addProxyObject(ntwkOff.getUuid(), "networkOfferingId");
}
throw ex;
}
@@ -1033,7 +1034,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(caller.getType())) {
// See DataCenterVO.java
PermissionDeniedException ex = new PermissionDeniedException("Cannot perform this operation since specified Zone is currently disabled");
- ex.addProxyObject(zone, zoneId, "zoneId");
+ ex.addProxyObject(zone.getUuid(), "zoneId");
throw ex;
}
@@ -1255,13 +1256,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
// Can add vlan range only to the network which allows it
if (createVlan && !ntwkOff.getSpecifyIpRanges()) {
InvalidParameterValueException ex = new InvalidParameterValueException("Network offering with specified id doesn't support adding multiple ip ranges");
- ex.addProxyObject(ntwkOff, ntwkOff.getId(), "networkOfferingId");
- String tablename = AnnotationHelper.getTableName(ntwkOff);
- if (tablename != null) {
- ex.addProxyObject(tablename, ntwkOff.getId(), "networkOfferingId");
- } else {
- s_logger.info("\nCould not retrieve table name (annotation) from " + tablename + " VO proxy object\n");
- }
+ ex.addProxyObject(ntwkOff.getUuid(), "networkOfferingId");
throw ex;
}
@@ -1346,7 +1341,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
} catch (ResourceUnavailableException ex) {
s_logger.warn("Failed to implement persistent guest network " + network + "due to ", ex);
CloudRuntimeException e = new CloudRuntimeException("Failed to implement persistent guest network");
- e.addProxyObject(network, network.getId(), "networkId");
+ e.addProxyObject(network.getUuid(), "networkId");
throw e;
}
}
@@ -1432,7 +1427,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (!_projectMgr.canAccessProjectAccount(caller, project.getProjectAccountId())) {
// getProject() returns type ProjectVO.
InvalidParameterValueException ex = new InvalidParameterValueException("Account " + caller + " cannot access specified project id");
- ex.addProxyObject(project, projectId, "projectId");
+ ex.addProxyObject(project.getUuid(), "projectId");
throw ex;
}
permittedAccounts.add(project.getProjectAccountId());
@@ -1757,14 +1752,14 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
// see NetworkVO.java
InvalidParameterValueException ex = new InvalidParameterValueException("unable to find network with specified id");
- ex.addProxyObject(network, networkId, "networkId");
+ ex.addProxyObject(String.valueOf(networkId), "networkId");
throw ex;
}
// don't allow to delete system network
if (isNetworkSystem(network)) {
InvalidParameterValueException ex = new InvalidParameterValueException("Network with specified id is system and can't be removed");
- ex.addProxyObject(network, network.getId(), "networkId");
+ ex.addProxyObject(network.getUuid(), "networkId");
throw ex;
}
@@ -1793,7 +1788,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
NetworkVO network = _networksDao.findById(networkId);
if (network == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Network with specified id doesn't exist");
- ex.addProxyObject("networks", networkId, "networkId");
+ ex.addProxyObject(networkId.toString(), "networkId");
throw ex;
}
@@ -1936,7 +1931,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (network == null) {
// see NetworkVO.java
InvalidParameterValueException ex = new InvalidParameterValueException("Specified network id doesn't exist in the system");
- ex.addProxyObject("networks", networkId, "networkId");
+ ex.addProxyObject(String.valueOf(networkId), "networkId");
throw ex;
}
@@ -1992,14 +1987,14 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (networkOfferingId != null) {
if (networkOffering == null || networkOffering.isSystemOnly()) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find network offering with specified id");
- ex.addProxyObject(networkOffering, networkOfferingId, "networkOfferingId");
+ ex.addProxyObject(networkOfferingId.toString(), "networkOfferingId");
throw ex;
}
// network offering should be in Enabled state
if (networkOffering.getState() != NetworkOffering.State.Enabled) {
InvalidParameterValueException ex = new InvalidParameterValueException("Network offering with specified id is not in " + NetworkOffering.State.Enabled + " state, can't upgrade to it");
- ex.addProxyObject(networkOffering, networkOfferingId, "networkOfferingId");
+ ex.addProxyObject(networkOffering.getUuid(), "networkOfferingId");
throw ex;
}
//can't update from vpc to non-vpc network offering
@@ -2021,7 +2016,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (changeCidr) {
if (!checkForNonStoppedVmInNetwork(network.getId())) {
InvalidParameterValueException ex = new InvalidParameterValueException("All user vm of network of specified id should be stopped before changing CIDR!");
- ex.addProxyObject(network, networkId, "networkId");
+ ex.addProxyObject(network.getUuid(), "networkId");
throw ex;
}
}
@@ -2154,7 +2149,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (!_networkMgr.shutdownNetworkElementsAndResources(context, true, network)) {
s_logger.warn("Failed to shutdown the network elements and resources as a part of network restart: " + network);
CloudRuntimeException ex = new CloudRuntimeException("Failed to shutdown the network elements and resources as a part of update to network of specified id");
- ex.addProxyObject(network, networkId, "networkId");
+ ex.addProxyObject(network.getUuid(), "networkId");
throw ex;
}
} else {
@@ -2173,13 +2168,13 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (!_networkMgr.shutdownNetwork(network.getId(), context, true)) {
s_logger.warn("Failed to shutdown the network as a part of update to network with specified id");
CloudRuntimeException ex = new CloudRuntimeException("Failed to shutdown the network as a part of update of specified network id");
- ex.addProxyObject(network, networkId, "networkId");
+ ex.addProxyObject(network.getUuid(), "networkId");
throw ex;
}
}
} else {
CloudRuntimeException ex = new CloudRuntimeException("Failed to shutdown the network elements and resources as a part of update to network with specified id; network is in wrong state: " + network.getState());
- ex.addProxyObject(network, networkId, "networkId");
+ ex.addProxyObject(network.getUuid(), "networkId");
throw ex;
}
}
@@ -2190,7 +2185,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
boolean validStateToImplement = (networkState == Network.State.Implemented || networkState == Network.State.Setup || networkState == Network.State.Allocated);
if (restartNetwork && !validStateToImplement) {
CloudRuntimeException ex = new CloudRuntimeException("Failed to implement the network elements and resources as a part of update to network with specified id; network is in wrong state: " + networkState);
- ex.addProxyObject(network, networkId, "networkId");
+ ex.addProxyObject(network.getUuid(), "networkId");
throw ex;
}
@@ -2241,7 +2236,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
} catch (Exception ex) {
s_logger.warn("Failed to implement network " + network + " elements and resources as a part of network update due to ", ex);
CloudRuntimeException e = new CloudRuntimeException("Failed to implement network (with specified id) elements and resources as a part of network update");
- e.addProxyObject(network, networkId, "networkId");
+ e.addProxyObject(network.getUuid(), "networkId");
throw e;
}
}
@@ -2259,7 +2254,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
"f network update due to ", ex);
CloudRuntimeException e = new CloudRuntimeException("Failed to implement network (with specified" +
" id) elements and resources as a part of network update");
- e.addProxyObject(network, networkId, "networkId");
+ e.addProxyObject(network.getUuid(), "networkId");
throw e;
}
}
@@ -2527,7 +2522,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
PhysicalNetworkVO network = _physicalNetworkDao.findById(id);
if (network == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Physical Network with specified id doesn't exist in the system");
- ex.addProxyObject(network, id, "physicalNetworkId");
+ ex.addProxyObject(id.toString(), "physicalNetworkId");
throw ex;
}
@@ -2535,7 +2530,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
DataCenter zone = _dcDao.findById(network.getDataCenterId());
if (zone == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Zone with id=" + network.getDataCenterId() + " doesn't exist in the system");
- ex.addProxyObject(zone, network.getDataCenterId(), "dataCenterId");
+ ex.addProxyObject(String.valueOf(network.getDataCenterId()), "dataCenterId");
throw ex;
}
if (newVnetRangeString != null) {
@@ -2804,7 +2799,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
PhysicalNetworkVO pNetwork = _physicalNetworkDao.findById(physicalNetworkId);
if (pNetwork == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Physical Network with specified id doesn't exist in the system");
- ex.addProxyObject(pNetwork, physicalNetworkId, "physicalNetworkId");
+ ex.addProxyObject(physicalNetworkId.toString(), "physicalNetworkId");
throw ex;
}
@@ -3100,7 +3095,12 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
Account account = _accountDao.findActiveAccount(accountName, domainId);
if (account == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find account " + accountName);
- ex.addProxyObject("domain", domainId, "domainId");
+ DomainVO domain = ApiDBUtils.findDomainById(domainId);
+ String domainUuid = domainId.toString();
+ if (domain != null ){
+ domainUuid = domain.getUuid();
+ }
+ ex.addProxyObject(domainUuid, "domainId");
throw ex;
} else {
accountId = account.getId();
@@ -3112,7 +3112,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
Project project = _projectMgr.getProject(projectId);
if (project == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find project by id " + projectId);
- ex.addProxyObject(project, projectId, "projectId");
+ ex.addProxyObject(projectId.toString(), "projectId");
throw ex;
}
accountId = project.getProjectAccountId();
@@ -3210,7 +3210,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
PhysicalNetworkVO network = _physicalNetworkDao.findById(physicalNetworkId);
if (network == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Physical Network with specified id doesn't exist in the system");
- ex.addProxyObject(network, physicalNetworkId, "physicalNetworkId");
+ ex.addProxyObject(physicalNetworkId.toString(), "physicalNetworkId");
throw ex;
}
@@ -3219,7 +3219,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
PhysicalNetworkVO destNetwork = _physicalNetworkDao.findById(destinationPhysicalNetworkId);
if (destNetwork == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Destination Physical Network with specified id doesn't exist in the system");
- ex.addProxyObject(destNetwork, destinationPhysicalNetworkId, "destinationPhysicalNetworkId");
+ ex.addProxyObject(destinationPhysicalNetworkId.toString(), "destinationPhysicalNetworkId");
throw ex;
}
}
@@ -3646,7 +3646,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
PhysicalNetworkVO network = _physicalNetworkDao.findById(physicalNetworkId);
if (network == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Physical Network with specified id doesn't exist in the system");
- ex.addProxyObject(network, physicalNetworkId, "physicalNetworkId");
+ ex.addProxyObject(physicalNetworkId.toString(), "physicalNetworkId");
throw ex;
}
@@ -3818,7 +3818,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (pNtwk == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find a physical network" +
" having the given id");
- ex.addProxyObject("physical_network", physicalNetworkId, "physicalNetworkId");
+ ex.addProxyObject(String.valueOf(physicalNetworkId), "physicalNetworkId");
throw ex;
}
@@ -3912,7 +3912,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (userVm == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Virtual mahine id does not exist");
- ex.addProxyObject(userVm, vmId, "vmId");
+ ex.addProxyObject(vmId.toString(), "vmId");
throw ex;
}
_accountMgr.checkAccess(caller, null, true, userVm);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
index 1d7b312..633357e 100755
--- a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
+++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
@@ -947,7 +947,11 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
UserVm vm = _vmDao.findById(instanceId);
if (vm == null || vm.getState() == State.Destroyed || vm.getState() == State.Expunging) {
InvalidParameterValueException ex = new InvalidParameterValueException("Invalid instance id specified");
- ex.addProxyObject(vm, instanceId, "instanceId");
+ if (vm == null) {
+ ex.addProxyObject(instanceId.toString(), "instanceId");
+ } else {
+ ex.addProxyObject(vm.getUuid(), "instanceId");
+ }
throw ex;
}
@@ -971,7 +975,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
if (nicInSameNetwork == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("VM " + instanceId
+ " cannot be added because it doesn't belong in the same network.");
- ex.addProxyObject(vm, instanceId, "instanceId");
+ ex.addProxyObject(vm.getUuid(), "instanceId");
throw ex;
}
@@ -1024,7 +1028,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
if (!success) {
CloudRuntimeException ex = new CloudRuntimeException("Failed to add specified loadbalancerruleid for vms "
+ instanceIds);
- ex.addProxyObject(loadBalancer, loadBalancerId, "loadBalancerId");
+ ex.addProxyObject(loadBalancer.getUuid(), "loadBalancerId");
// TBD: Also pack in the instanceIds in the exception using the
// right VO object or table name.
throw ex;
@@ -1075,7 +1079,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
s_logger.warn("Failed to remove load balancer rule id " + loadBalancerId + " for vms " + instanceIds);
CloudRuntimeException ex = new CloudRuntimeException(
"Failed to remove specified load balancer rule id for vms " + instanceIds);
- ex.addProxyObject(loadBalancer, loadBalancerId, "loadBalancerId");
+ ex.addProxyObject(loadBalancer.getUuid(), "loadBalancerId");
throw ex;
}
success = true;
@@ -1098,7 +1102,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
if (!success) {
CloudRuntimeException ex = new CloudRuntimeException(
"Failed to remove specified load balancer rule id for vms " + instanceIds);
- ex.addProxyObject(loadBalancer, loadBalancerId, "loadBalancerId");
+ ex.addProxyObject(loadBalancer.getUuid(), "loadBalancerId");
throw ex;
}
return success;
@@ -1368,12 +1372,17 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
if (ipAddr == null || !ipAddr.readyToUse()) {
InvalidParameterValueException ex = new InvalidParameterValueException(
"Unable to create load balancer rule, invalid IP address id specified");
- ex.addProxyObject(ipAddr, sourceIpId, "sourceIpId");
+ if (ipAddr == null){
+ ex.addProxyObject(String.valueOf(sourceIpId), "sourceIpId");
+ }
+ else{
+ ex.addProxyObject(ipAddr.getUuid(), "sourceIpId");
+ }
throw ex;
} else if (ipAddr.isOneToOneNat()) {
InvalidParameterValueException ex = new InvalidParameterValueException(
"Unable to create load balancer rule; specified sourceip id has static nat enabled");
- ex.addProxyObject(ipAddr, sourceIpId, "sourceIpId");
+ ex.addProxyObject(ipAddr.getUuid(), "sourceIpId");
throw ex;
}
@@ -1384,7 +1393,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
if (networkId == null) {
InvalidParameterValueException ex = new InvalidParameterValueException(
"Unable to create load balancer rule ; specified sourceip id is not associated with any network");
- ex.addProxyObject(ipAddr, sourceIpId, "sourceIpId");
+ ex.addProxyObject(ipAddr.getUuid(), "sourceIpId");
throw ex;
}
@@ -2083,7 +2092,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
if (!_networkModel.areServicesSupportedInNetwork(network.getId(), Service.Lb)) {
InvalidParameterValueException ex = new InvalidParameterValueException(
"LB service is not supported in specified network id");
- ex.addProxyObject(network, network.getId(), "networkId");
+ ex.addProxyObject(network.getUuid(), "networkId");
throw ex;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/server/src/com/cloud/network/rules/RulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/RulesManagerImpl.java b/server/src/com/cloud/network/rules/RulesManagerImpl.java
index 3c95cef..dd5f99b 100755
--- a/server/src/com/cloud/network/rules/RulesManagerImpl.java
+++ b/server/src/com/cloud/network/rules/RulesManagerImpl.java
@@ -1257,14 +1257,14 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
if (ipAddress.getSystem()) {
InvalidParameterValueException ex = new InvalidParameterValueException("Can't disable static nat for system IP address with specified id");
- ex.addProxyObject(ipAddress, ipId, "ipId");
+ ex.addProxyObject(ipAddress.getUuid(), "ipId");
throw ex;
}
Long vmId = ipAddress.getAssociatedWithVmId();
if (vmId == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Specified IP address id is not associated with any vm Id");
- ex.addProxyObject(ipAddress, ipId, "ipId");
+ ex.addProxyObject(ipAddress.getUuid(), "ipId");
throw ex;
}
@@ -1292,7 +1292,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
if (!ipAddress.isOneToOneNat()) {
InvalidParameterValueException ex = new InvalidParameterValueException("One to one nat is not enabled for the specified ip id");
- ex.addProxyObject(ipAddress, ipId, "ipId");
+ ex.addProxyObject(ipAddress.getUuid(), "ipId");
throw ex;
}
@@ -1353,14 +1353,14 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
if (ip == null || !ip.isOneToOneNat() || ip.getAssociatedWithVmId() == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Source ip address of the specified firewall rule id is not static nat enabled");
- ex.addProxyObject(ruleVO, rule.getId(), "ruleId");
+ ex.addProxyObject(ruleVO.getUuid(), "ruleId");
throw ex;
}
String dstIp = ip.getVmIp();
if (dstIp == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("VM ip address of the specified public ip is not set ");
- ex.addProxyObject(ruleVO, rule.getId(), "ruleId");
+ ex.addProxyObject(ruleVO.getUuid(), "ruleId");
throw ex;
}
@@ -1432,7 +1432,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
Network network = _networkModel.getNetwork(networkId);
if (network == null) {
CloudRuntimeException ex = new CloudRuntimeException("Unable to find an ip address to map to specified vm id");
- ex.addProxyObject(vm, vm.getId(), "vmId");
+ ex.addProxyObject(vm.getUuid(), "vmId");
throw ex;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index 15e1539..380a95e 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -587,7 +587,11 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
if (vpcOff == null || vpcOff.getState() != State.Enabled) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find vpc offering in " + State.Enabled +
" state by specified id");
- ex.addProxyObject("vpc_offerings", vpcOffId, "vpcOfferingId");
+ if (vpcOff == null) {
+ ex.addProxyObject(String.valueOf(vpcOffId), "vpcOfferingId");
+ } else {
+ ex.addProxyObject(vpcOff.getUuid(), "vpcOfferingId");
+ }
throw ex;
}
@@ -596,7 +600,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(caller.getType())) {
// See DataCenterVO.java
PermissionDeniedException ex = new PermissionDeniedException("Cannot perform this operation since specified Zone is currently disabled");
- ex.addProxyObject("data_center", zone.getId(), "zoneId");
+ ex.addProxyObject(zone.getUuid(), "zoneId");
throw ex;
}
@@ -943,7 +947,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
Vpc vpc = getActiveVpc(vpcId);
if (vpc == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find Enabled VPC by id specified");
- ex.addProxyObject("vpc", vpcId, "VPC");
+ ex.addProxyObject(String.valueOf(vpcId), "VPC");
throw ex;
}
@@ -1275,7 +1279,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
Vpc vpc = getActiveVpc(vpcId);
if (vpc == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find Enabled VPC by id specified");
- ex.addProxyObject("vpc", vpcId, "VPC");
+ ex.addProxyObject(String.valueOf(vpcId), "VPC");
throw ex;
}
@@ -1354,7 +1358,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
Vpc vpc = getActiveVpc(vpcId);
if (vpc == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find Enabled VPC by id specified");
- ex.addProxyObject("vpc", vpcId, "VPC");
+ ex.addProxyObject(String.valueOf(vpcId), "VPC");
throw ex;
}
@@ -2016,7 +2020,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
if (vpc == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find Enabled VPC ");
- ex.addProxyObject("vpc", vpcId, "VPC");
+ ex.addProxyObject(String.valueOf(vpcId), "VPC");
throw ex;
}
_accountMgr.checkAccess(caller, null, false, vpc);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/server/src/com/cloud/projects/ProjectManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/projects/ProjectManagerImpl.java b/server/src/com/cloud/projects/ProjectManagerImpl.java
index de4f3cc..7ab385f 100755
--- a/server/src/com/cloud/projects/ProjectManagerImpl.java
+++ b/server/src/com/cloud/projects/ProjectManagerImpl.java
@@ -43,6 +43,7 @@ import org.apache.cloudstack.acl.SecurityChecker.AccessType;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
+import com.cloud.api.ApiDBUtils;
import com.cloud.api.query.dao.ProjectAccountJoinDao;
import com.cloud.api.query.dao.ProjectInvitationJoinDao;
import com.cloud.api.query.dao.ProjectJoinDao;
@@ -50,6 +51,7 @@ import com.cloud.configuration.Config;
import com.cloud.configuration.ConfigurationManager;
import com.cloud.configuration.Resource.ResourceType;
import com.cloud.configuration.dao.ConfigurationDao;
+import com.cloud.domain.DomainVO;
import com.cloud.domain.dao.DomainDao;
import com.cloud.event.ActionEvent;
import com.cloud.event.EventTypes;
@@ -508,14 +510,14 @@ public class ProjectManagerImpl extends ManagerBase implements ProjectManager {
if (project == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find project with specified id");
- ex.addProxyObject(project, projectId, "projectId");
+ ex.addProxyObject(String.valueOf(projectId), "projectId");
throw ex;
}
//User can be added to Active project only
if (project.getState() != Project.State.Active) {
InvalidParameterValueException ex = new InvalidParameterValueException("Can't add account to the specified project id in state=" + project.getState() + " as it's no longer active");
- ex.addProxyObject(project, projectId, "projectId");
+ ex.addProxyObject(project.getUuid(),"projectId");
throw ex;
}
@@ -525,8 +527,12 @@ public class ProjectManagerImpl extends ManagerBase implements ProjectManager {
account = _accountMgr.getActiveAccountByName(accountName, project.getDomainId());
if (account == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find account name=" + accountName + " in specified domain id");
- // We don't have a DomainVO object with us, so just pass the tablename "domain" manually.
- ex.addProxyObject("domain", project.getDomainId(), "domainId");
+ DomainVO domain = ApiDBUtils.findDomainById(project.getDomainId());
+ String domainUuid = String.valueOf(project.getDomainId());
+ if ( domain != null ){
+ domainUuid = domain.getUuid();
+ }
+ ex.addProxyObject(domainUuid, "domainId");
throw ex;
}
@@ -590,7 +596,7 @@ public class ProjectManagerImpl extends ManagerBase implements ProjectManager {
if (project == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find project with specified id");
- ex.addProxyObject(project, projectId, "projectId");
+ ex.addProxyObject(String.valueOf(projectId), "projectId");
throw ex;
}
@@ -598,8 +604,12 @@ public class ProjectManagerImpl extends ManagerBase implements ProjectManager {
Account account = _accountMgr.getActiveAccountByName(accountName, project.getDomainId());
if (account == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find account name=" + accountName + " in domain id=" + project.getDomainId());
- // Since we don't have a domainVO object, pass the table name manually.
- ex.addProxyObject("domain", project.getDomainId(), "domainId");
+ DomainVO domain = ApiDBUtils.findDomainById(project.getDomainId());
+ String domainUuid = String.valueOf(project.getDomainId());
+ if ( domain != null ){
+ domainUuid = domain.getUuid();
+ }
+ ex.addProxyObject(domainUuid, "domainId");
}
//verify permissions
@@ -610,14 +620,14 @@ public class ProjectManagerImpl extends ManagerBase implements ProjectManager {
if (projectAccount == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Account " + accountName + " is not assigned to the project with specified id");
// Use the projectVO object and not the projectAccount object to inject the projectId.
- ex.addProxyObject(project, projectId, "projectId");
+ ex.addProxyObject(project.getUuid(), "projectId");
throw ex;
}
//can't remove the owner of the project
if (projectAccount.getAccountRole() == Role.Admin) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to delete account " + accountName + " from the project with specified id as the account is the owner of the project");
- ex.addProxyObject(project, projectId, "projectId");
+ ex.addProxyObject(project.getUuid(), "projectId");
throw ex;
}
@@ -791,7 +801,7 @@ public class ProjectManagerImpl extends ManagerBase implements ProjectManager {
if (project == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find project with specified id");
- ex.addProxyObject(project, projectId, "projectId");
+ ex.addProxyObject(String.valueOf(projectId), "projectId");
throw ex;
}
@@ -833,7 +843,7 @@ public class ProjectManagerImpl extends ManagerBase implements ProjectManager {
//verify input parameters
if (project == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find project with specified id");
- ex.addProxyObject(project, projectId, "projectId");
+ ex.addProxyObject(String.valueOf(projectId), "projectId");
throw ex;
}
@@ -844,7 +854,7 @@ public class ProjectManagerImpl extends ManagerBase implements ProjectManager {
return _projectDao.findById(projectId);
} else {
CloudRuntimeException ex = new CloudRuntimeException("Failed to suspend project with specified id");
- ex.addProxyObject(project, projectId, "projectId");
+ ex.addProxyObject(project.getUuid(), "projectId");
throw ex;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index 13780d2..f767b68 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -391,7 +391,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
if (zone == null) {
InvalidParameterValueException ex = new InvalidParameterValueException(
"Can't find zone by the id specified");
- ex.addProxyObject(zone, dcId, "dcId");
+ ex.addProxyObject(String.valueOf(dcId), "dcId");
throw ex;
}
@@ -400,7 +400,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
&& !_accountMgr.isRootAdmin(account.getType())) {
PermissionDeniedException ex = new PermissionDeniedException(
"Cannot perform this operation, Zone with specified id is currently disabled");
- ex.addProxyObject(zone, dcId, "dcId");
+ ex.addProxyObject(zone.getUuid(), "dcId");
throw ex;
}
@@ -419,8 +419,8 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
if (!Long.valueOf(pod.getDataCenterId()).equals(dcId)) {
InvalidParameterValueException ex = new InvalidParameterValueException(
"Pod with specified id doesn't belong to the zone " + dcId);
- ex.addProxyObject(pod, podId, "podId");
- ex.addProxyObject(zone, dcId, "dcId");
+ ex.addProxyObject(pod.getUuid(), "podId");
+ ex.addProxyObject(zone.getUuid(), "dcId");
throw ex;
}
@@ -504,8 +504,8 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
"Unable to create cluster " + clusterName
+ " in pod and data center with specified ids", e);
// Get the pod VO object's table name.
- ex.addProxyObject(pod, podId, "podId");
- ex.addProxyObject(zone, dcId, "dcId");
+ ex.addProxyObject(pod.getUuid(), "podId");
+ ex.addProxyObject(zone.getUuid(), "dcId");
throw ex;
}
clusterId = cluster.getId();
@@ -639,7 +639,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
if (cluster == null) {
InvalidParameterValueException ex = new InvalidParameterValueException(
"can not find cluster for specified clusterId");
- ex.addProxyObject(cluster, clusterId, "clusterId");
+ ex.addProxyObject(clusterId.toString(), "clusterId");
throw ex;
} else {
if (cluster.getGuid() == null) {
@@ -647,7 +647,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
if (!hosts.isEmpty()) {
CloudRuntimeException ex = new CloudRuntimeException(
"Guid is not updated for cluster with specified cluster id; need to wait for hosts in this cluster to come up");
- ex.addProxyObject(cluster, clusterId, "clusterId");
+ ex.addProxyObject(cluster.getUuid(), "clusterId");
throw ex;
}
}
@@ -703,7 +703,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
&& !_accountMgr.isRootAdmin(account.getType())) {
PermissionDeniedException ex = new PermissionDeniedException(
"Cannot perform this operation, Zone with specified id is currently disabled");
- ex.addProxyObject(zone, dcId, "dcId");
+ ex.addProxyObject(zone.getUuid(), "dcId");
throw ex;
}
@@ -721,8 +721,8 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
+ podId
+ " doesn't belong to the zone with specified zoneId"
+ dcId);
- ex.addProxyObject(pod, podId, "podId");
- ex.addProxyObject(zone, dcId, "dcId");
+ ex.addProxyObject(pod.getUuid(), "podId");
+ ex.addProxyObject(zone.getUuid(), "dcId");
throw ex;
}
}
@@ -792,8 +792,8 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
+ clusterName
+ " in pod with specified podId and data center with specified dcID",
e);
- ex.addProxyObject(pod, podId, "podId");
- ex.addProxyObject(zone, dcId, "dcId");
+ ex.addProxyObject(pod.getUuid(), "podId");
+ ex.addProxyObject(zone.getUuid(), "dcId");
throw ex;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 8323af8..d5d95f8 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -1153,7 +1153,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
}
InvalidParameterValueException ex = new InvalidParameterValueException("VM is not Running, cannot " +
"migrate the vm with specified id");
- ex.addProxyObject(vm, vmId, "vmId");
+ ex.addProxyObject(vm.getUuid(), "vmId");
throw ex;
}
@@ -1174,8 +1174,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
}
InvalidParameterValueException ex = new InvalidParameterValueException(
"Unable to find the host (with specified id) of VM with specified id");
- ex.addProxyObject(srcHost, srcHostId, "hostId");
- ex.addProxyObject(vm, vmId, "vmId");
+ ex.addProxyObject(String.valueOf(srcHostId), "hostId");
+ ex.addProxyObject(vm.getUuid(), "vmId");
throw ex;
}
@@ -1331,7 +1331,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
if (volume == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find volume with" +
" specified id.");
- ex.addProxyObject(volume, volumeId, "volumeId");
+ ex.addProxyObject(volumeId.toString(), "volumeId");
throw ex;
}
@@ -1585,8 +1585,12 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
+ " in specified domain");
// Since we don't have a DomainVO object here, we directly set
// tablename to "domain".
- String tablename = "domain";
- ex.addProxyObject(tablename, domainId, "domainId");
+ DomainVO domain = ApiDBUtils.findDomainById(domainId);
+ String domainUuid = domainId.toString();
+ if ( domain != null ){
+ domainUuid = domain.getUuid();
+ }
+ ex.addProxyObject(domainUuid, "domainId");
throw ex;
} else {
accountId = account.getId();
@@ -1606,7 +1610,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
Project project = _projectMgr.getProject(projectId);
if (project == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find project by id " + projectId);
- ex.addProxyObject(project, projectId, "projectId");
+ ex.addProxyObject(projectId.toString(), "projectId");
throw ex;
}
accountId = project.getProjectAccountId();
@@ -1840,14 +1844,14 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
if (isIso && template.getFormat() != ImageFormat.ISO) {
s_logger.error("Template Id " + templateId + " is not an ISO");
InvalidParameterValueException ex = new InvalidParameterValueException("Specified Template Id is not an ISO");
- ex.addProxyObject(template, templateId, "templateId");
+ ex.addProxyObject(template.getUuid(), "templateId");
throw ex;
}// If ISO not requested then it shouldn't be an ISO.
if (!isIso && template.getFormat() == ImageFormat.ISO) {
s_logger.error("Incorrect format of the template id " + templateId);
InvalidParameterValueException ex = new InvalidParameterValueException("Incorrect format " + template.getFormat()
+ " of the specified template id");
- ex.addProxyObject(template, templateId, "templateId");
+ ex.addProxyObject(template.getUuid(), "templateId");
throw ex;
}
}
@@ -1951,14 +1955,14 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
VMTemplateVO template = _templateDao.findById(id);
if (template == null || template.getRemoved() != null) {
InvalidParameterValueException ex = new InvalidParameterValueException("unable to find template/iso with specified id");
- ex.addProxyObject(template, id, "templateId");
+ ex.addProxyObject(id.toString(), "templateId");
throw ex;
}
// Don't allow to modify system template
if (id.equals(Long.valueOf(1))) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to update template/iso of specified id");
- ex.addProxyObject(template, id, "templateId");
+ ex.addProxyObject(template.getUuid(), "templateId");
throw ex;
}
@@ -2306,7 +2310,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
DomainVO domain = _domainDao.findById(domainId);
if (domain == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find domain with specified domain id");
- ex.addProxyObject(domain, domainId, "domainId");
+ ex.addProxyObject(domainId.toString(), "domainId");
throw ex;
} else if (domain.getParent() == null && domainName != null) {
// check if domain is ROOT domain - and deny to edit it with the new
@@ -2330,7 +2334,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
if (!domains.isEmpty() && !sameDomain) {
InvalidParameterValueException ex = new InvalidParameterValueException("Failed to update specified domain id with name '"
+ domainName + "' since it already exists in the system");
- ex.addProxyObject(domain, domainId, "domainId");
+ ex.addProxyObject(domain.getUuid(), "domainId");
throw ex;
}
}
@@ -3236,7 +3240,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
VMInstanceVO systemVm = _vmInstanceDao.findByIdTypes(instanceId, VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm);
if (systemVm == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find a system vm of specified instanceId");
- ex.addProxyObject(systemVm, instanceId, "instanceId");
+ ex.addProxyObject(String.valueOf(instanceId), "instanceId");
throw ex;
}
return systemVm.getType();
@@ -3248,7 +3252,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
VMInstanceVO systemVm = _vmInstanceDao.findByIdTypes(vmId, VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm);
if (systemVm == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("unable to find a system vm with specified vmId");
- ex.addProxyObject(systemVm, vmId, "vmId");
+ ex.addProxyObject(String.valueOf(vmId), "vmId");
throw ex;
}
@@ -3258,7 +3262,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
return startSecondaryStorageVm(vmId);
} else {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find a system vm with specified vmId");
- ex.addProxyObject(systemVm, vmId, "vmId");
+ ex.addProxyObject(systemVm.getUuid(), "vmId");
throw ex;
}
}
@@ -3271,7 +3275,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
VMInstanceVO systemVm = _vmInstanceDao.findByIdTypes(id, VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm);
if (systemVm == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("unable to find a system vm with specified vmId");
- ex.addProxyObject(systemVm, id, "vmId");
+ ex.addProxyObject(id.toString(), "vmId");
throw ex;
}
@@ -3293,7 +3297,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
if (systemVm == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("unable to find a system vm with specified vmId");
- ex.addProxyObject(systemVm, cmd.getId(), "vmId");
+ ex.addProxyObject(cmd.getId().toString(), "vmId");
throw ex;
}
@@ -3310,7 +3314,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
if (systemVm == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("unable to find a system vm with specified vmId");
- ex.addProxyObject(systemVm, cmd.getId(), "vmId");
+ ex.addProxyObject(cmd.getId().toString(), "vmId");
throw ex;
}
@@ -3348,7 +3352,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
User user = _accountMgr.getUserIncludingRemoved(userId);
if ((user == null) || (user.getRemoved() != null)) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find active user of specified id");
- ex.addProxyObject(user, userId, "userId");
+ ex.addProxyObject(String.valueOf(userId), "userId");
throw ex;
}
@@ -3444,7 +3448,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
VolumeVO volume = _volumeDao.findById(volumeId);
if (volume == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find volume with specified volumeId");
- ex.addProxyObject(volume, volumeId, "volumeId");
+ ex.addProxyObject(volumeId.toString(), "volumeId");
throw ex;
}
@@ -3464,7 +3468,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
+ ". It should be either detached or the VM should be in stopped state.");
PermissionDeniedException ex = new PermissionDeniedException(
"Invalid state of the volume with specified ID. It should be either detached or the VM should be in stopped state.");
- ex.addProxyObject(volume, volumeId, "volumeId");
+ ex.addProxyObject(volume.getUuid(), "volumeId");
throw ex;
}
@@ -3481,7 +3485,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
if (!isExtractable && account != null && account.getType() != Account.ACCOUNT_TYPE_ADMIN) { // Global
// admins are always allowed to extract
PermissionDeniedException ex = new PermissionDeniedException("The volume with specified volumeId is not allowed to be extracted");
- ex.addProxyObject(volume, volumeId, "volumeId");
+ ex.addProxyObject(volume.getUuid(), "volumeId");
throw ex;
}
}
@@ -3639,7 +3643,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
InstanceGroupVO group = _vmGroupDao.findById(groupId.longValue());
if (group == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("unable to find a vm group with specified groupId");
- ex.addProxyObject(group, groupId, "groupId");
+ ex.addProxyObject(groupId.toString(), "groupId");
throw ex;
}
@@ -3845,7 +3849,12 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
if (s == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("A key pair with name '" + cmd.getName()
+ "' does not exist for account " + owner.getAccountName() + " in specified domain id");
- ex.addProxyObject(owner, owner.getDomainId(), "domainId");
+ DomainVO domain = ApiDBUtils.findDomainById(owner.getDomainId());
+ String domainUuid = String.valueOf(owner.getDomainId());
+ if (domain != null){
+ domainUuid = domain.getUuid();
+ }
+ ex.addProxyObject(domainUuid, "domainId");
throw ex;
}
@@ -3932,7 +3941,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
UserVmVO vm = _userVmDao.findById(cmd.getId());
if (vm == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("No VM with specified id found.");
- ex.addProxyObject(vm, cmd.getId(), "vmId");
+ ex.addProxyObject(cmd.getId().toString(), "vmId");
throw ex;
}
@@ -3943,7 +3952,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
String password = vm.getDetail("Encrypted.Password");
if (password == null || password.equals("")) {
InvalidParameterValueException ex = new InvalidParameterValueException("No password for VM with specified id found.");
- ex.addProxyObject(vm, cmd.getId(), "vmId");
+ ex.addProxyObject(vm.getUuid(), "vmId");
throw ex;
}
@@ -4053,7 +4062,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
if (hpvCapabilities == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("unable to find the hypervisor capabilities for specified id");
- ex.addProxyObject(hpvCapabilities, id, "Id");
+ ex.addProxyObject(id.toString(), "Id");
throw ex;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e557767/server/src/com/cloud/user/DomainManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/DomainManagerImpl.java b/server/src/com/cloud/user/DomainManagerImpl.java
index c451041..00a779e 100644
--- a/server/src/com/cloud/user/DomainManagerImpl.java
+++ b/server/src/com/cloud/user/DomainManagerImpl.java
@@ -226,7 +226,7 @@ public class DomainManagerImpl extends ManagerBase implements DomainManager, Dom
if ((cleanup != null) && cleanup.booleanValue()) {
if (!cleanupDomain(domain.getId(), ownerId)) {
CloudRuntimeException e = new CloudRuntimeException("Failed to clean up domain resources and sub domains, delete failed on domain " + domain.getName() + " (id: " + domain.getId() + ").");
- e.addProxyObject(domain, domain.getId(), "domainId");
+ e.addProxyObject(domain.getUuid(), "domainId");
throw e;
}
} else {
@@ -235,13 +235,13 @@ public class DomainManagerImpl extends ManagerBase implements DomainManager, Dom
if (!_domainDao.remove(domain.getId())) {
rollBackState = true;
CloudRuntimeException e = new CloudRuntimeException("Delete failed on domain " + domain.getName() + " (id: " + domain.getId() + "); Please make sure all users and sub domains have been removed from the domain before deleting");
- e.addProxyObject(domain, domain.getId(), "domainId");
+ e.addProxyObject(domain.getUuid(), "domainId");
throw e;
}
} else {
rollBackState = true;
CloudRuntimeException e = new CloudRuntimeException("Can't delete the domain yet because it has " + accountsForCleanup.size() + "accounts that need a cleanup");
- e.addProxyObject(domain, domain.getId(), "domainId");
+ e.addProxyObject(domain.getUuid(), "domainId");
throw e;
}
}
@@ -480,7 +480,7 @@ public class DomainManagerImpl extends ManagerBase implements DomainManager, Dom
DomainVO domain = _domainDao.findById(domainId);
if (domain == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find domain with specified domain id");
- ex.addProxyObject(domain, domainId, "domainId");
+ ex.addProxyObject(domainId.toString(), "domainId");
throw ex;
} else if (domain.getParent() == null && domainName != null) {
// check if domain is ROOT domain - and deny to edit it with the new name
@@ -501,7 +501,7 @@ public class DomainManagerImpl extends ManagerBase implements DomainManager, Dom
if (!domains.isEmpty() && !sameDomain) {
InvalidParameterValueException ex = new InvalidParameterValueException("Failed to update specified domain id with name '" + domainName + "' since it already exists in the system");
- ex.addProxyObject(domain, domainId, "domainId");
+ ex.addProxyObject(domain.getUuid(), "domainId");
throw ex;
}
}