Updated Branches:
  refs/heads/4.2 7ee655f5c -> a337cae7c

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


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a337cae7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a337cae7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a337cae7

Branch: refs/heads/4.2
Commit: a337cae7ca11a563453c987ee598741bb8e22f52
Parents: 7ee655f
Author: Alena Prokharchyk <alena.prokharc...@citrix.com>
Authored: Thu Jul 25 16:34:03 2013 -0700
Committer: Alena Prokharchyk <alena.prokharc...@citrix.com>
Committed: Thu Jul 25 16:39:04 2013 -0700

----------------------------------------------------------------------
 server/src/com/cloud/network/guru/ControlNetworkGuru.java | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a337cae7/server/src/com/cloud/network/guru/ControlNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/ControlNetworkGuru.java 
b/server/src/com/cloud/network/guru/ControlNetworkGuru.java
index e7c5cba..fc10d1f 100755
--- a/server/src/com/cloud/network/guru/ControlNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/ControlNetworkGuru.java
@@ -109,7 +109,7 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru 
implements NetworkGu
     public NicProfile allocate(Network config, NicProfile nic, 
VirtualMachineProfile<? extends VirtualMachine> 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<? extends 
VirtualMachine> 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;

Reply via email to