Updated Branches:
refs/heads/master 8dd4197cd -> 361ca9643
CS-15173: Additional Cluster is allowed to add with the same VSM IPaddress as
the previous cluster
Description:
Restricting association of a Cisco Nexus VSM to a single
cluster.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/361ca964
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/361ca964
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/361ca964
Branch: refs/heads/master
Commit: 361ca9643d22875675f325693971a5ba3a82326f
Parents: 8dd4197
Author: Vijayendra Bhamidipati <[email protected]>
Authored: Fri Jun 22 13:31:56 2012 -0700
Committer: Sheng Yang <[email protected]>
Committed: Fri Jun 22 13:31:56 2012 -0700
----------------------------------------------------------------------
api/src/com/cloud/api/commands/AddClusterCmd.java | 11 +-
api/src/com/cloud/resource/ResourceService.java | 3 +-
.../com/cloud/resource/ResourceManagerImpl.java | 1704 ++++++++-------
.../hypervisor/vmware/mo/HypervisorHostHelper.java | 10 +-
4 files changed, 884 insertions(+), 844 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/361ca964/api/src/com/cloud/api/commands/AddClusterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/AddClusterCmd.java
b/api/src/com/cloud/api/commands/AddClusterCmd.java
index 6688dee..0ff77e0 100755
--- a/api/src/com/cloud/api/commands/AddClusterCmd.java
+++ b/api/src/com/cloud/api/commands/AddClusterCmd.java
@@ -31,8 +31,10 @@ import com.cloud.api.ServerApiException;
import com.cloud.api.response.ClusterResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.exception.DiscoveryException;
+import com.cloud.exception.ResourceInUseException;
import com.cloud.org.Cluster;
import com.cloud.user.Account;
+import com.cloud.utils.IdentityProxy;
@Implementation(description="Adds a new cluster",
responseObject=ClusterResponse.class)
public class AddClusterCmd extends BaseCmd {
@@ -166,7 +168,14 @@ public class AddClusterCmd extends BaseCmd {
this.setResponseObject(response);
} catch (DiscoveryException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR,
ex.getMessage());
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR,
ex.getMessage());
+ } catch (ResourceInUseException ex) {
+ s_logger.warn("Exception: ", ex);
+ ServerApiException e = new
ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ for (IdentityProxy proxyObj : ex.getIdProxyList()) {
+ e.addProxyObject(proxyObj.getTableName(), proxyObj.getValue(),
proxyObj.getidFieldName());
+ }
+ throw e;
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/361ca964/api/src/com/cloud/resource/ResourceService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/resource/ResourceService.java
b/api/src/com/cloud/resource/ResourceService.java
index d971a40..1065453 100755
--- a/api/src/com/cloud/resource/ResourceService.java
+++ b/api/src/com/cloud/resource/ResourceService.java
@@ -31,6 +31,7 @@ import com.cloud.api.commands.UpdateHostCmd;
import com.cloud.api.commands.UpdateHostPasswordCmd;
import com.cloud.exception.DiscoveryException;
import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceInUseException;
import com.cloud.host.Host;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.org.Cluster;
@@ -61,7 +62,7 @@ public interface ResourceService {
* @throws IllegalArgumentException
* @throws DiscoveryException
*/
- List<? extends Cluster> discoverCluster(AddClusterCmd cmd) throws
IllegalArgumentException, DiscoveryException;
+ List<? extends Cluster> discoverCluster(AddClusterCmd cmd) throws
IllegalArgumentException, DiscoveryException, ResourceInUseException;
boolean deleteCluster(DeleteClusterCmd cmd);