mirror of https://github.com/apache/cloudstack.git
VPC: don't allow vm to be a part of more than one VPC
This commit is contained in:
parent
24023fd14d
commit
21cdd08948
|
|
@ -2341,6 +2341,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
List<Pair<NetworkVO, NicProfile>> networks = new ArrayList<Pair<NetworkVO, NicProfile>>();
|
||||
short defaultNetworkNumber = 0;
|
||||
boolean securityGroupEnabled = false;
|
||||
boolean vpcNetwork = false;
|
||||
for (NetworkVO network : networkList) {
|
||||
if (network.getDataCenterId() != zone.getId()) {
|
||||
throw new InvalidParameterValueException("Network id=" + network.getId() + " doesn't belong to zone " + zone.getId());
|
||||
|
|
@ -2368,6 +2369,14 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
if (_networkMgr.isSecurityGroupSupportedInNetwork(network)) {
|
||||
securityGroupEnabled = true;
|
||||
}
|
||||
|
||||
//vm can't be a part of more than 1 VPC network
|
||||
if (network.getVpcId() != null) {
|
||||
if (vpcNetwork) {
|
||||
throw new InvalidParameterValueException("Vm can't be a part of more than 1 VPC network");
|
||||
}
|
||||
vpcNetwork = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (securityGroupIdList != null && !securityGroupIdList.isEmpty() && !securityGroupEnabled) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue