mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-752: Removed 1 private gateway for VPC limitation.
Verified that more than 8 private gateways can be created.
This commit is contained in:
parent
e85b1cbe8f
commit
c94a75c0a6
|
|
@ -3974,7 +3974,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
}
|
||||
|
||||
protected String getLowestAvailableVIFDeviceNum(Connection conn, VM vm) {
|
||||
String vmName = "";
|
||||
try {
|
||||
vmName = vm.getNameLabel(conn);
|
||||
List<Integer> usedDeviceNums = new ArrayList<Integer>();
|
||||
Set<VIF> vifs = vm.getVIFs(conn);
|
||||
Iterator<VIF> vifIter = vifs.iterator();
|
||||
|
|
@ -3983,14 +3985,15 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
try{
|
||||
usedDeviceNums.add(Integer.valueOf(vif.getDevice(conn)));
|
||||
} catch (NumberFormatException e) {
|
||||
s_logger.debug("Obtained an invalid value for an allocated VIF device number for VM: " + vm.getNameLabel(conn));
|
||||
return null;
|
||||
String msg = "Obtained an invalid value for an allocated VIF device number for VM: " + vmName;
|
||||
s_logger.debug(msg, e);
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
for(Integer i=0; i< _maxNics; i++){
|
||||
if(!usedDeviceNums.contains(i)){
|
||||
s_logger.debug("Lowest available Vif device number: "+i+" for VM: " + vm.getNameLabel(conn));
|
||||
s_logger.debug("Lowest available Vif device number: "+i+" for VM: " + vmName);
|
||||
return i.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -4002,7 +4005,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
s_logger.warn(msg, e);
|
||||
}
|
||||
|
||||
return null;
|
||||
throw new CloudRuntimeException("Could not find available VIF slot in VM with name: " + vmName);
|
||||
}
|
||||
|
||||
protected VDI mount(Connection conn, StoragePoolType pooltype, String volumeFolder, String volumePath) {
|
||||
|
|
|
|||
|
|
@ -341,11 +341,11 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||
_agentMgr.send(dest.getHost().getId(), cmds);
|
||||
PlugNicAnswer plugNicAnswer = cmds.getAnswer(PlugNicAnswer.class);
|
||||
if (!(plugNicAnswer != null && plugNicAnswer.getResult())) {
|
||||
s_logger.warn("Unable to plug nic for vm " + vm.getHostName());
|
||||
s_logger.warn("Unable to plug nic for vm " + vm.getName());
|
||||
result = false;
|
||||
}
|
||||
} catch (OperationTimedoutException e) {
|
||||
throw new AgentUnavailableException("Unable to plug nic for router " + vm.getHostName() + " in network " + network,
|
||||
throw new AgentUnavailableException("Unable to plug nic for router " + vm.getName() + " in network " + network,
|
||||
dest.getHost().getId(), e);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1233,13 +1233,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager{
|
|||
ex.addProxyObject("vpc", vpcId, "VPC");
|
||||
throw ex;
|
||||
}
|
||||
|
||||
//allow only one private gateway per vpc
|
||||
VpcGatewayVO gatewayVO = _vpcGatewayDao.getPrivateGatewayForVpc(vpcId);
|
||||
if (gatewayVO != null) {
|
||||
throw new InvalidParameterValueException("Private ip address already exists for vpc " + vpc);
|
||||
}
|
||||
|
||||
|
||||
//Validate physical network
|
||||
if (physicalNetworkId == null) {
|
||||
List<? extends PhysicalNetwork> pNtwks = _ntwkModel.getPhysicalNtwksSupportingTrafficType(vpc.getZoneId(), TrafficType.Guest);
|
||||
|
|
@ -1258,7 +1252,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager{
|
|||
vlan, ipAddress, null, gateway, netmask, gatewayOwnerId, vpcId);
|
||||
|
||||
//2) create gateway entry
|
||||
gatewayVO = new VpcGatewayVO(ipAddress, VpcGateway.Type.Private, vpcId, privateNtwk.getDataCenterId(),
|
||||
VpcGatewayVO gatewayVO = new VpcGatewayVO(ipAddress, VpcGateway.Type.Private, vpcId, privateNtwk.getDataCenterId(),
|
||||
privateNtwk.getId(), vlan, gateway, netmask, vpc.getAccountId(), vpc.getDomainId());
|
||||
_vpcGatewayDao.persist(gatewayVO);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue