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 b3927ff
Date Tue, 25 Jun 2013 13:47:51 GMT
Updated Branches:
  refs/heads/master 1ab87ef4b -> b3927ffe9


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 <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/b3927ffe
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b3927ffe
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b3927ffe

Branch: refs/heads/master
Commit: b3927ffe966a278dd70777ddf13fa08859f5916b
Parents: 1ab87ef
Author: Sateesh Chodapuneedi <sateesh@apache.org>
Authored: Tue Jun 25 19:15:24 2013 +0530
Committer: Sateesh Chodapuneedi <sateesh@apache.org>
Committed: Tue Jun 25 19:15:24 2013 +0530

----------------------------------------------------------------------
 .../vmware/manager/VmwareManagerImpl.java       |  3 ++-
 .../vmware/mo/HypervisorHostHelper.java         | 26 ++++++++++++++++----
 2 files changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b3927ffe/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 68acd9e..77a95a4 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
@@ -115,7 +115,7 @@ import com.cloud.vm.DomainRouterVO;
 import com.google.gson.Gson;
 import com.vmware.vim25.AboutInfo;
 import com.vmware.vim25.HostConnectSpec;
-import com.vmware.vim25.ManagedObjectReference;;
+import com.vmware.vim25.ManagedObjectReference;
 
 
 @Local(value = {VmwareManager.class, VmwareDatacenterService.class})
@@ -227,6 +227,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/b3927ffe/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;
     }
 


Mime
View raw message