CLOUDSTACK-3232: InternalLB system vm - allocate control ip address from the private range when vm's hypervisor is vmWare

This commit is contained in:
Alena Prokharchyk 2013-07-25 16:34:03 -07:00
parent 6a916b9e82
commit 2e0847bfe0

View File

@ -109,7 +109,7 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
InsufficientAddressCapacityException {
if(vm.getHypervisorType() == HypervisorType.VMware && vm.getType() != VirtualMachine.Type.DomainRouter) {
if(vm.getHypervisorType() == HypervisorType.VMware && !isRouterVm(vm)) {
NicProfile nicProf = new NicProfile(Nic.ReservationStrategy.Create, null, null, null, null);
String mac = _networkMgr.getNextAvailableMacAddressInNetwork(config.getId());
nicProf.setMacAddress(mac);
@ -132,7 +132,7 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
InsufficientAddressCapacityException {
assert nic.getTrafficType() == TrafficType.Control;
if (dest.getHost().getHypervisorType() == HypervisorType.VMware && vm.getType() == VirtualMachine.Type.DomainRouter) {
if (dest.getHost().getHypervisorType() == HypervisorType.VMware && isRouterVm(vm)) {
if(dest.getDataCenter().getNetworkType() != NetworkType.Basic) {
super.reserve(nic, config, vm, dest, context);
@ -166,7 +166,7 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
assert nic.getTrafficType() == TrafficType.Control;
if (vm.getHypervisorType() == HypervisorType.VMware && vm.getType() == VirtualMachine.Type.DomainRouter) {
if (vm.getHypervisorType() == HypervisorType.VMware && isRouterVm(vm)) {
long dcId = vm.getVirtualMachine().getDataCenterId();
DataCenterVO dcVo = _dcDao.findById(dcId);
if(dcVo.getNetworkType() != NetworkType.Basic) {
@ -194,6 +194,10 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
return true;
}
protected boolean isRouterVm(VirtualMachineProfile<? extends VirtualMachine> vm) {
return vm.getType() == VirtualMachine.Type.DomainRouter || vm.getType() == VirtualMachine.Type.InternalLoadBalancerVm;
}
@Override
public Network implement(Network config, NetworkOffering offering, DeployDestination destination, ReservationContext context) throws InsufficientVirtualNetworkCapcityException {
assert config.getTrafficType() == TrafficType.Control : "Why are you sending this configuration to me " + config;