You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2018/05/11 16:46:24 UTC

[cloudstack] branch 4.11 updated: CLOUDSTACK-9184: Fixes #2631 VMware dvs portgroup autogrowth (#2634)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.11
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.11 by this push:
     new 1b3046e  CLOUDSTACK-9184: Fixes #2631 VMware dvs portgroup autogrowth (#2634)
1b3046e is described below

commit 1b3046e3767a5e2a989ae7a47d35289cec3f06bf
Author: Rohit Yadav <ro...@apache.org>
AuthorDate: Fri May 11 22:16:13 2018 +0530

    CLOUDSTACK-9184: Fixes #2631 VMware dvs portgroup autogrowth (#2634)
    
    * CLOUDSTACK-9184: Fixes #2631 VMware dvs portgroup autogrowth
    
    This deprecates the vmware.ports.per.dvportgroup global setting.
    
    The vSphere Auto Expand feature (introduced in vSphere 5.0) will take
    care of dynamically increasing/decreasing the dvPorts when running out
    of distributed ports . But in case of vSphere 4.1/4.0 (If used), as this
    feature is not there, the new default value (=> 8) have an impact in the
    existing deployments. Action item for vSphere 4.1/4.0: Admin should
    modify the global configuration setting "vmware.ports.per.dvportgroup"
    from 8 to any number based on their environment because the proposal
    default value of 8 would be very less without auto expand feature in
    general. The current default value of 256 may not need immediate
    modification after deployment, but 8 would be very less which means
    admin need to update immediately after upgrade.
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 .../META-INF/db/schema-41100to41110-cleanup.sql          |  4 +++-
 .../hypervisor/vmware/manager/VmwareManagerImpl.java     | 16 ++++++++++++----
 server/src/com/cloud/configuration/Config.java           |  8 --------
 .../cloud/hypervisor/vmware/mo/HypervisorHostHelper.java |  9 ++++-----
 4 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/engine/schema/resources/META-INF/db/schema-41100to41110-cleanup.sql b/engine/schema/resources/META-INF/db/schema-41100to41110-cleanup.sql
index 704c71e..2c5855e 100644
--- a/engine/schema/resources/META-INF/db/schema-41100to41110-cleanup.sql
+++ b/engine/schema/resources/META-INF/db/schema-41100to41110-cleanup.sql
@@ -17,4 +17,6 @@
 
 --;
 -- Schema upgrade from 4.11.0.0 to 4.11.1.0
---;
\ No newline at end of file
+--;
+
+DELETE FROM `cloud`.`configuration` WHERE `name`='vmware.ports.per.dvportgroup';
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 3cf0c00..f586f39 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
@@ -136,6 +136,8 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
     private static final Logger s_logger = Logger.getLogger(VmwareManagerImpl.class);
 
     private static final long SECONDS_PER_MINUTE = 60;
+    private static final int DEFAULT_PORTS_PER_DV_PORT_GROUP_VSPHERE4_x = 256;
+    private static final int DEFAULT_PORTS_PER_DV_PORT_GROUP = 8;
 
     private int _timeout;
 
@@ -194,7 +196,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
     private StorageLayer _storage;
     private final String _privateNetworkVSwitchName = "vSwitch0";
 
-    private int _portsPerDvPortGroup = 256;
+    private int _portsPerDvPortGroup = DEFAULT_PORTS_PER_DV_PORT_GROUP;
     private boolean _fullCloneFlag;
     private boolean _instanceNameFlag;
     private String _serviceConsoleName;
@@ -279,8 +281,6 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
             _instanceNameFlag = Boolean.parseBoolean(value);
         }
 
-        _portsPerDvPortGroup = NumbersUtil.parseInt(_configDao.getValue(Config.VmwarePortsPerDVPortGroup.key()), _portsPerDvPortGroup);
-
         _serviceConsoleName = _configDao.getValue(Config.VmwareServiceConsole.key());
         if (_serviceConsoleName == null) {
             _serviceConsoleName = "Service Console";
@@ -394,8 +394,16 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
             HypervisorHostHelper.prepareNetwork(vSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000, false, BroadcastDomainType.Vlan, null, null);
         }
         else {
+            int portsPerDvPortGroup = _portsPerDvPortGroup;
+            AboutInfo about = hostMo.getHostAboutInfo();
+            if (about != null) {
+                String version = about.getApiVersion();
+                if (version != null && (version.equals("4.0") || version.equals("4.1")) && _portsPerDvPortGroup < DEFAULT_PORTS_PER_DV_PORT_GROUP_VSPHERE4_x) {
+                    portsPerDvPortGroup = DEFAULT_PORTS_PER_DV_PORT_GROUP_VSPHERE4_x;
+                }
+            }
             HypervisorHostHelper.prepareNetwork(vSwitchName, "cloud.private", hostMo, vlanId, null, null, null, 180000,
-                    vsType, _portsPerDvPortGroup, null, false, BroadcastDomainType.Vlan, null, null);
+                    vsType, portsPerDvPortGroup, null, false, BroadcastDomainType.Vlan, null, null);
         }
     }
 
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index b2c4460..98bacf2 100644
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -1139,14 +1139,6 @@ public enum Config {
             "false",
             "Enable/Disable Nexus/Vmware dvSwitch in VMware environment",
             null),
-    VmwarePortsPerDVPortGroup(
-            "Network",
-            ManagementServer.class,
-            Integer.class,
-            "vmware.ports.per.dvportgroup",
-            "256",
-            "Default number of ports per Vmware dvPortGroup in VMware environment",
-            null),
     VmwareCreateFullClone(
             "Advanced",
             ManagementServer.class,
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 bab697a..ecfa8ee 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
@@ -755,9 +755,8 @@ public class HypervisorHostHelper {
             dvsPortSetting = createVmwareDVPortSettingSpec(shapingPolicy, secPolicy, pvlanSpec);
         }
 
-        newDvPortGroupSpec = createDvPortGroupSpec(networkName, dvsPortSetting, numPorts, autoExpandSupported);
-        if (portGroupPolicy != null)
-        {
+        newDvPortGroupSpec = createDvPortGroupSpec(networkName, dvsPortSetting, autoExpandSupported);
+        if (portGroupPolicy != null) {
             newDvPortGroupSpec.setPolicy(portGroupPolicy);
         }
 
@@ -765,6 +764,7 @@ public class HypervisorHostHelper {
             s_logger.info("Distributed Virtual Port group " + networkName + " not found.");
             // TODO(sateesh): Handle Exceptions
             try {
+                newDvPortGroupSpec.setNumPorts(numPorts);
                 dvSwitchMo.createDVPortGroup(newDvPortGroupSpec);
             } catch (Exception e) {
                 String msg = "Failed to create distributed virtual port group " + networkName + " on dvSwitch " + physicalNetwork;
@@ -994,13 +994,12 @@ public class HypervisorHostHelper {
         return true;
     }
 
-    public static DVPortgroupConfigSpec createDvPortGroupSpec(String dvPortGroupName, DVPortSetting portSetting, int numPorts, boolean autoExpandSupported) {
+    public static DVPortgroupConfigSpec createDvPortGroupSpec(String dvPortGroupName, DVPortSetting portSetting, boolean autoExpandSupported) {
         DVPortgroupConfigSpec spec = new DVPortgroupConfigSpec();
         spec.setName(dvPortGroupName);
         spec.setDefaultPortConfig(portSetting);
         spec.setPortNameFormat("vnic<portIndex>");
         spec.setType("earlyBinding");
-        spec.setNumPorts(numPorts);
         spec.setAutoExpand(autoExpandSupported);
         return spec;
     }

-- 
To stop receiving notification emails like this one, please contact
rohit@apache.org.