cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kous...@apache.org
Subject git commit: refs/heads/4.1 - CLOUDSTACK-435: Vmware network labels are ignored when creating a Zone using basic networking Due to incorrect logic the private network traffic label specified was not getting used, instead some default was getting used (vSw
Date Mon, 04 Feb 2013 18:47:37 GMT
Updated Branches:
  refs/heads/4.1 ed6074573 -> cce80832a


CLOUDSTACK-435: Vmware network labels are ignored when creating a Zone using basic networking
Due to incorrect logic the private network traffic label specified was not getting used, instead
some default was getting used (vSwitch0 or privateEthernetPortProfile). The fix passes the
correct label in the format vSwitchX or vSwitchX,<vlan_id> and based on that the correct
switch is used.


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

Branch: refs/heads/4.1
Commit: cce80832a7ee08ca6d8f6ef16df54d61b702b676
Parents: ed60745
Author: Koushik Das <koushik.das@citrix.com>
Authored: Thu Nov 1 23:40:34 2012 +0530
Committer: Koushik Das <koushik.das@citrix.com>
Committed: Mon Feb 4 23:56:01 2013 +0530

----------------------------------------------------------------------
 .../vmware/manager/VmwareManagerImpl.java          |  103 +++++----------
 1 files changed, 31 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/cce80832/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
index 7939620..88e03f5 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
@@ -344,6 +344,34 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager,
Vmw
         return _netMgr.getDefaultGuestTrafficLabel(dcId, hypervisorType);
     }
 
+    private void prepareHost(HostMO hostMo, String privateTrafficLabel) throws Exception
{
+        // For ESX host, we need to enable host firewall to allow VNC access
+        HostFirewallSystemMO firewallMo = hostMo.getHostFirewallSystemMO();
+        if(firewallMo != null) {
+            if(hostMo.getHostType() == VmwareHostType.ESX) {
+                firewallMo.enableRuleset("vncServer");
+                firewallMo.refreshFirewall();
+            }
+        }
+
+        // prepare at least one network on the vswitch to enable OVF importing
+        String vSwitchName = privateTrafficLabel;
+        String vlanId = null;
+        String[] tokens = privateTrafficLabel.split(",");
+        if(tokens.length == 2) {
+            vSwitchName = tokens[0].trim();
+            vlanId = tokens[1].trim();
+        }
+
+        s_logger.info("Preparing network on host " + hostMo.getContext().toString() + " for
" + privateTrafficLabel);
+        if(!_nexusVSwitchActive) {
+            HypervisorHostHelper.prepareNetwork(vSwitchName, "cloud.private", hostMo, vlanId,
null, null, 180000, false);
+        }
+        else {
+            HypervisorHostHelper.prepareNetwork(vSwitchName, "cloud.private", hostMo, vlanId,
null, null, 180000);
+        }
+    }
+    
     @Override
     public List<ManagedObjectReference> addHostToPodCluster(VmwareContext serviceContext,
long dcId, Long podId, Long clusterId,
             String hostInventoryPath) throws Exception {
@@ -365,30 +393,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager,
Vmw
 
                 // For ESX host, we need to enable host firewall to allow VNC access
                 HostMO hostMo = new HostMO(serviceContext, hosts[0]);
-                HostFirewallSystemMO firewallMo = hostMo.getHostFirewallSystemMO();
-                if(firewallMo != null) {
-                    if(hostMo.getHostType() == VmwareHostType.ESX) {
-
-                        firewallMo.enableRuleset("vncServer");
-                        firewallMo.refreshFirewall();
-                    }
-                }
-
-                // prepare at least one network on the vswitch to enable OVF importing
-                String vlanId = null;
-                if(privateTrafficLabel != null) {
-                    String[] tokens = privateTrafficLabel.split(",");
-                    if(tokens.length == 2)
-                        vlanId = tokens[1];
-                }
-
-                if(!_nexusVSwitchActive) {
-                    HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private",
hostMo, vlanId, null, null, 180000, false);
-                }
-                else {
-                    s_logger.info("Preparing Network on " + privateTrafficLabel);
-                    HypervisorHostHelper.prepareNetwork(privateTrafficLabel, "cloud.private",
hostMo, vlanId, null, null, 180000);
-                }
+                prepareHost(hostMo, privateTrafficLabel);
                 returnedHostList.add(hosts[0]);
                 return returnedHostList;
             } else if(mor.getType().equals("ClusterComputeResource")) {
@@ -404,60 +409,14 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager,
Vmw
                 for(ManagedObjectReference morHost: hosts) {
                     // For ESX host, we need to enable host firewall to allow VNC access
                     HostMO hostMo = new HostMO(serviceContext, morHost);
-                    HostFirewallSystemMO firewallMo = hostMo.getHostFirewallSystemMO();
-                    if(firewallMo != null) {
-                        if(hostMo.getHostType() == VmwareHostType.ESX) {
-                            firewallMo.enableRuleset("vncServer");
-                            firewallMo.refreshFirewall();
-                        }
-                    }
-
-                    String vlanId = null;
-                    if(privateTrafficLabel != null) {
-                        String[] tokens = privateTrafficLabel.split(",");
-                        if(tokens.length == 2)
-                            vlanId = tokens[1];
-                    }
-
-
-                    s_logger.info("Calling prepareNetwork : " + hostMo.getContext().toString());
-                    // prepare at least one network on the vswitch to enable OVF importing
-                    if(!_nexusVSwitchActive) {
-                        HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private",
hostMo, vlanId, null, null, 180000, false);
-                    }
-                    else {
-                        s_logger.info("Preparing Network on " + privateTrafficLabel);
-                        HypervisorHostHelper.prepareNetwork(privateTrafficLabel, "cloud.private",
hostMo, vlanId, null, null, 180000);
-                    }
+                    prepareHost(hostMo, privateTrafficLabel);
                     returnedHostList.add(morHost);
                 }
                 return returnedHostList;
             } else if(mor.getType().equals("HostSystem")) {
                 // For ESX host, we need to enable host firewall to allow VNC access
                 HostMO hostMo = new HostMO(serviceContext, mor);
-                HostFirewallSystemMO firewallMo = hostMo.getHostFirewallSystemMO();
-                if(firewallMo != null) {
-                    if(hostMo.getHostType() == VmwareHostType.ESX) {
-                        firewallMo.enableRuleset("vncServer");
-                        firewallMo.refreshFirewall();
-                    }
-                }
-
-                String vlanId = null;
-                if(privateTrafficLabel != null) {
-                    String[] tokens = privateTrafficLabel.split(",");
-                    if(tokens.length == 2)
-                        vlanId = tokens[1];
-                }
-
-                // prepare at least one network on the vswitch to enable OVF importing
-                if(!_nexusVSwitchActive) {
-                    HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private",
hostMo, vlanId, null, null, 180000, false);
-                }
-                else {
-                    s_logger.info("Preparing Network on " + privateTrafficLabel);
-                    HypervisorHostHelper.prepareNetwork(privateTrafficLabel, "cloud.private",
hostMo, vlanId, null, null, 180000);
-                }
+                prepareHost(hostMo, privateTrafficLabel);
                 returnedHostList.add(mor);
                 return returnedHostList;
             } else {


Mime
View raw message