You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sa...@apache.org on 2013/06/25 16:54:31 UTC

[3/4] git commit: updated refs/heads/master-6-17-stable to 348f0ab

CLOUDSTACK-1766 VmWare DVS vmware.ports.per.dvportgroup setting not used

Read the global configuration setting while configuring VmwareManager.
Also enabling autoExpand feature for supported distributed virtual switch versions.

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


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

Branch: refs/heads/master-6-17-stable
Commit: a7637cb615c05f26a6104f21b785132165b2eb25
Parents: 34bdd1e
Author: Sateesh Chodapuneedi <sa...@apache.org>
Authored: Tue Jun 25 19:15:24 2013 +0530
Committer: Sateesh Chodapuneedi <sa...@apache.org>
Committed: Tue Jun 25 19:51:09 2013 +0530

----------------------------------------------------------------------
 .../vmware/manager/VmwareManagerImpl.java       |  1 +
 .../vmware/mo/HypervisorHostHelper.java         | 26 ++++++++++++++++----
 2 files changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7637cb6/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 a604392..1ded389 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
@@ -224,6 +224,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
         } else {
             _fullCloneFlag = Boolean.parseBoolean(value);
         }
+        _portsPerDvPortGroup = NumbersUtil.parseInt(_configDao.getValue(Config.VmwarePortsPerDVPortGroup.key()), _portsPerDvPortGroup);
 
         _serviceConsoleName = _configDao.getValue(Config.VmwareServiceConsole.key());
         if(_serviceConsoleName == null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7637cb6/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 157c7a6..3739058 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
@@ -438,6 +438,9 @@ public class HypervisorHostHelper {
         String dvSwitchName = null;
         boolean bWaitPortGroupReady = false;
         boolean createGCTag = false;
+        String vcApiVersion;
+        String minVcApiVersionSupportingAutoExpand;
+        boolean autoExpandSupported;
         String networkName;
         Integer vid = null;
         Integer spvlanid = null;  // secondary pvlan id
@@ -462,6 +465,9 @@ public class HypervisorHostHelper {
             DVPortgroupConfigSpec dvPortGroupSpec;
             DVPortgroupConfigInfo dvPortgroupInfo;
             //DVSConfigInfo dvsInfo;
+            vcApiVersion = getVcenterApiVersion(context);
+            minVcApiVersionSupportingAutoExpand = "5.0";
+            autoExpandSupported = isFeatureSupportedInVcenterApiVersion(vcApiVersion, minVcApiVersionSupportingAutoExpand);
 
             dvSwitchName = physicalNetwork;
             // TODO(sateesh): Remove this after ensuring proper default value for vSwitchName throughout traffic types
@@ -571,7 +577,7 @@ public class HypervisorHostHelper {
             dvsPortSetting = createVmwareDVPortSettingSpec(shapingPolicy, secPolicy, vlanSpec);
             }
 
-            dvPortGroupSpec = createDvPortGroupSpec(networkName, dvsPortSetting, numPorts);
+            dvPortGroupSpec = createDvPortGroupSpec(networkName, dvsPortSetting, numPorts, autoExpandSupported);
 
             if (!dataCenterMo.hasDvPortGroup(networkName)) {
                 s_logger.info("Distributed Virtual Port group " + networkName + " not found.");
@@ -656,6 +662,18 @@ public class HypervisorHostHelper {
         return new Pair<ManagedObjectReference, String>(morNetwork, networkName);
     }
 
+    public static String getVcenterApiVersion(VmwareContext serviceContext) throws Exception {
+        String vcApiVersion = null;
+        if (serviceContext != null) {
+            vcApiVersion = serviceContext.getServiceContent().getAbout().getApiVersion();
+        }
+        return vcApiVersion;
+    }
+
+    public static boolean isFeatureSupportedInVcenterApiVersion(String vCenterApiVersion, String minVcenterApiVersionForFeature) {
+        return vCenterApiVersion.compareTo(minVcenterApiVersionForFeature) >= 0 ? true : false;
+    }
+
     public static ManagedObjectReference waitForDvPortGroupReady(
 			DatacenterMO dataCenterMo, String dvPortGroupName, long timeOutMs) throws Exception {
 		ManagedObjectReference morDvPortGroup = null;
@@ -710,16 +728,14 @@ public class HypervisorHostHelper {
 		return true;
 	}
 
-    public static DVPortgroupConfigSpec createDvPortGroupSpec(String dvPortGroupName, DVPortSetting portSetting, int numPorts) {
+    public static DVPortgroupConfigSpec createDvPortGroupSpec(String dvPortGroupName, DVPortSetting portSetting, int numPorts, boolean autoExpandSupported) {
         DVPortgroupConfigSpec spec = new DVPortgroupConfigSpec();
         spec.setName(dvPortGroupName);
         spec.setDefaultPortConfig(portSetting);
         spec.setPortNameFormat("vnic<portIndex>");
         spec.setType("earlyBinding");
         spec.setNumPorts(numPorts);
-        // TODO(sateesh): Get vSphere API version and
-        // if >= 5.0 set autoExpand property of dvPortGroup config spec to true.
-        // spec.setAutoExpand(true);
+        spec.setAutoExpand(autoExpandSupported);
         return spec;
     }