mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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.
This commit is contained in:
parent
8dd4197cd8
commit
361ca9643d
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -194,6 +194,7 @@ public class HypervisorHostHelper {
|
||||
netconfClient.disconnect();
|
||||
s_logger.debug("Disconnected Nexus 1000v session.");
|
||||
}
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
|
||||
List<Pair<OperationType, String>> params = new ArrayList<Pair<OperationType, String>>();
|
||||
@ -212,6 +213,7 @@ public class HypervisorHostHelper {
|
||||
netconfClient.disconnect();
|
||||
s_logger.debug("Disconnected Nexus 1000v session.");
|
||||
}
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,6 +232,7 @@ public class HypervisorHostHelper {
|
||||
netconfClient.disconnect();
|
||||
s_logger.debug("Disconnected Nexus 1000v session.");
|
||||
}
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -241,7 +244,8 @@ public class HypervisorHostHelper {
|
||||
catch(CloudRuntimeException e) {
|
||||
msg = "Failed to associate policy map " + policyName + " with port profile " + networkName
|
||||
+ ". Exception: " + e.toString();
|
||||
s_logger.error(msg);
|
||||
s_logger.error(msg);
|
||||
throw new CloudRuntimeException(msg);
|
||||
} finally {
|
||||
if (netconfClient != null) {
|
||||
netconfClient.disconnect();
|
||||
@ -301,6 +305,7 @@ public class HypervisorHostHelper {
|
||||
netconfClient.disconnect();
|
||||
s_logger.debug("Disconnected Nexus 1000v session.");
|
||||
}
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -315,6 +320,7 @@ public class HypervisorHostHelper {
|
||||
netconfClient.disconnect();
|
||||
s_logger.debug("Disconnected Nexus 1000v session.");
|
||||
}
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -352,6 +358,7 @@ public class HypervisorHostHelper {
|
||||
netconfClient.disconnect();
|
||||
s_logger.debug("Disconnected Nexus 1000v session.");
|
||||
}
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -364,6 +371,7 @@ public class HypervisorHostHelper {
|
||||
netconfClient.disconnect();
|
||||
s_logger.debug("Disconnected Nexus 1000v session.");
|
||||
}
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user