cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sate...@apache.org
Subject git commit: updated refs/heads/master to c36a952
Date Tue, 25 Jun 2013 14:15:20 GMT
Updated Branches:
  refs/heads/master b3927ffe9 -> c36a952f1


CLOUDSTACK-1767 VMWare DVS - cannot use untagged portgroups

Signed-off-by: Sateesh Chodapuneedi <sateesh@apache.org>


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

Branch: refs/heads/master
Commit: c36a952f159fccb899409a8eca97e0f7621905e3
Parents: b3927ff
Author: Sateesh Chodapuneedi <sateesh@apache.org>
Authored: Tue Jun 25 19:43:20 2013 +0530
Committer: Sateesh Chodapuneedi <sateesh@apache.org>
Committed: Tue Jun 25 19:43:20 2013 +0530

----------------------------------------------------------------------
 .../vmware/manager/VmwareManagerImpl.java       |  9 ++--
 .../vmware/resource/VmwareResource.java         |  6 ++-
 .../com/cloud/network/VmwareTrafficLabel.java   |  5 ++-
 .../vmware/mo/HypervisorHostHelper.java         | 47 +++++++-------------
 4 files changed, 32 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c36a952f/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 77a95a4..06451d8 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
@@ -336,12 +336,15 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager,
Vmw
         // prepare at least one network on the vswitch to enable OVF importing
         String vSwitchName = privateTrafficLabel;
         String vlanId = null;
+        String vlanToken;
         String[] tokens = privateTrafficLabel.split(",");
-        if(tokens.length == 2) {
+        if(tokens.length >= 2) {
             vSwitchName = tokens[0].trim();
-            vlanId = tokens[1].trim();
+            vlanToken = tokens[1].trim();
+            if (!vlanToken.isEmpty()) {
+                vlanId = vlanToken;
+            }
         }
-
         s_logger.info("Preparing network on host " + hostMo.getContext().toString() + " for
" + privateTrafficLabel);
         HypervisorHostHelper.prepareNetwork(vSwitchName, "cloud.private", hostMo, vlanId,
null, null, 180000, false);
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c36a952f/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 32e28d1..d860383 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -2981,7 +2981,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
             // If all 3 fields are mentioned then number of tokens would be 3.
             // If only <VSWITCH>,<VLANID> are mentioned then number of tokens
would be 2.
             if(tokens.length == 2 || tokens.length == 3) {
-                return new Pair<String, String>(tokens[0], tokens[1]);
+                String vlanToken = tokens[1];
+                if (vlanToken.isEmpty()) {
+                    vlanToken = Vlan.UNTAGGED;
+                }
+                return new Pair<String, String>(tokens[0], vlanToken);
             } else {
                 return new Pair<String, String>(nicTo.getName(), Vlan.UNTAGGED);
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c36a952f/plugins/hypervisors/vmware/src/com/cloud/network/VmwareTrafficLabel.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/network/VmwareTrafficLabel.java b/plugins/hypervisors/vmware/src/com/cloud/network/VmwareTrafficLabel.java
index 90a4278..8d2890a 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/network/VmwareTrafficLabel.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/network/VmwareTrafficLabel.java
@@ -74,7 +74,10 @@ public class VmwareTrafficLabel implements TrafficLabel {
             _vSwitchName = tokens[VMWARE_LABEL_FIELD_INDEX_NAME].trim();
         }
         if (tokens.length > VMWARE_LABEL_FIELD_INDEX_VLANID) {
-            _vlanId = tokens[VMWARE_LABEL_FIELD_INDEX_VLANID].trim();
+            String vlanToken = tokens[VMWARE_LABEL_FIELD_INDEX_VLANID].trim();
+            if (!vlanToken.isEmpty()) {
+                _vlanId = vlanToken;
+            }
         }
         if (tokens.length > VMWARE_LABEL_FIELD_INDEX_VSWITCH_TYPE) {
             _vSwitchType = VirtualSwitchType.getType(tokens[VMWARE_LABEL_FIELD_INDEX_VSWITCH_TYPE].trim());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c36a952f/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
index 3739058..994fb30 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
@@ -461,7 +461,7 @@ public class HypervisorHostHelper {
             VmwareDistributedVirtualSwitchPvlanSpec pvlanSpec = null;
             //VMwareDVSPvlanConfigSpec pvlanSpec = null;
             DVSSecurityPolicy secPolicy;
-            VMwareDVSPortSetting dvsPortSetting;
+            VMwareDVSPortSetting dvsPortSetting = null;
             DVPortgroupConfigSpec dvPortGroupSpec;
             DVPortgroupConfigInfo dvPortgroupInfo;
             //DVSConfigInfo dvsInfo;
@@ -551,30 +551,21 @@ public class HypervisorHostHelper {
             }
 
             // Next, create the port group. For this, we need to create a VLAN spec.
-            if (vid == null) {
-                vlanSpec = createDVPortVlanSpec();
-            } else {
-                if (spvlanid == null) {
-                    // Create vlan spec.
-                    vlanSpec = createDVPortVlanIdSpec(vid);
-                } else {
-                    // Create a pvlan spec. The pvlan spec is different from the pvlan config
spec
-                    // that we created earlier. The pvlan config spec is used to configure
the switch
-                    // with a <primary vlanId, secondary vlanId> tuple. The pvlan spec
is used
-                    // to configure a port group (i.e., a network) with a secondary vlan
id. We don't
-                    // need to mention more than the secondary vlan id because one secondary
vlan id
-                    // can be associated with only one primary vlan id. Give vCenter the
secondary vlan id,
-                    // and it will find out the associated primary vlan id and do the rest
of the
-                    // port group configuration.
-                    pvlanSpec = createDVPortPvlanIdSpec(spvlanid);
-            }
-            }
-
             // NOTE - VmwareDistributedVirtualSwitchPvlanSpec extends VmwareDistributedVirtualSwitchVlanSpec.
-            if (pvlanSpec != null) {
+            if (vid == null || spvlanid == null) {
+                vlanSpec = createDVPortVlanIdSpec(vid);
+                dvsPortSetting = createVmwareDVPortSettingSpec(shapingPolicy, secPolicy,
vlanSpec);
+            } else if (spvlanid != null) {
+                // Create a pvlan spec. The pvlan spec is different from the pvlan config
spec
+                // that we created earlier. The pvlan config spec is used to configure the
switch
+                // with a <primary vlanId, secondary vlanId> tuple. The pvlan spec
is used
+                // to configure a port group (i.e., a network) with a secondary vlan id.
We don't
+                // need to mention more than the secondary vlan id because one secondary
vlan id
+                // can be associated with only one primary vlan id. Give vCenter the secondary
vlan id,
+                // and it will find out the associated primary vlan id and do the rest of
the
+                // port group configuration.
+                pvlanSpec = createDVPortPvlanIdSpec(spvlanid);
                 dvsPortSetting = createVmwareDVPortSettingSpec(shapingPolicy, secPolicy,
pvlanSpec);
-            } else {
-            dvsPortSetting = createVmwareDVPortSettingSpec(shapingPolicy, secPolicy, vlanSpec);
             }
 
             dvPortGroupSpec = createDvPortGroupSpec(networkName, dvsPortSetting, numPorts,
autoExpandSupported);
@@ -804,17 +795,13 @@ public class HypervisorHostHelper {
         pvlanConfigSpec.setOperation(operation.toString());
         return pvlanConfigSpec;
     }
-    public static VmwareDistributedVirtualSwitchVlanIdSpec createDVPortVlanIdSpec(int vlanId)
{
+
+    public static VmwareDistributedVirtualSwitchVlanIdSpec createDVPortVlanIdSpec(Integer
vlanId) {
         VmwareDistributedVirtualSwitchVlanIdSpec vlanIdSpec = new VmwareDistributedVirtualSwitchVlanIdSpec();
-        vlanIdSpec.setVlanId(vlanId);
+        vlanIdSpec.setVlanId(vlanId == null ? 0 : vlanId.intValue());
         return vlanIdSpec;
     }
 
-    public static VmwareDistributedVirtualSwitchVlanSpec createDVPortVlanSpec() {
-        VmwareDistributedVirtualSwitchVlanSpec vlanSpec = new VmwareDistributedVirtualSwitchVlanSpec();
-        return vlanSpec;
-    }
-
     public static DVSSecurityPolicy createDVSSecurityPolicy() {
         DVSSecurityPolicy secPolicy = new DVSSecurityPolicy();
         BoolPolicy allow = new BoolPolicy();


Mime
View raw message