Repository: cloudstack
Updated Branches:
  refs/heads/master b5c132582 -> 96a6e673a


CLOUDSTACK-7078 CLONE - [VMWARE]System VM's are failed to start with Nexus 
enabled Zone Since introducing pool of session contexts we no more have a 
dedicated context for each VMware hypervisor host. Hence vsm credentials stored 
in session context cannot be retrieved always correctly. Fix is to register the 
vsm credentials after fetching context and the context gets recycled after use.

Signed-off-by: Sateesh Chodapuneedi <[email protected]>


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

Branch: refs/heads/master
Commit: 96a6e673a3dcfcb6c27bd56264e388ccd68f9e47
Parents: b5c1325
Author: Sateesh Chodapuneedi <[email protected]>
Authored: Thu Jul 31 17:48:35 2014 +0530
Committer: Sateesh Chodapuneedi <[email protected]>
Committed: Thu Jul 31 16:31:41 2014 +0530

----------------------------------------------------------------------
 .../hypervisor/vmware/resource/VmwareResource.java      | 12 ++++--------
 .../hypervisor/vmware/mo/HypervisorHostHelper.java      |  6 +++++-
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/96a6e673/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 b076b61..c6258a2 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
@@ -299,6 +299,7 @@ public class VmwareResource implements StoragePoolResource, 
ServerResource, Vmwa
     protected String _privateNetworkVSwitchName;
     protected VmwareTrafficLabel _guestTrafficInfo = new 
VmwareTrafficLabel(TrafficType.Guest);
     protected VmwareTrafficLabel _publicTrafficInfo = new 
VmwareTrafficLabel(TrafficType.Public);
+    protected Map<String, String> _vsmCredentials = null;
     protected int _portsPerDvPortGroup;
     protected boolean _fullCloneFlag = false;
     protected boolean _instanceNameFlag = false;
@@ -1001,7 +1002,7 @@ public class VmwareResource implements 
StoragePoolResource, ServerResource, Vmwa
         } else {
             networkInfo =
                     
HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(), 
"cloud.public", vmMo.getRunningHost(), vlanId, null, null, null,
-                            _opsTimeout, vSwitchType, _portsPerDvPortGroup, 
null, false, BroadcastDomainType.Vlan);
+                            _opsTimeout, vSwitchType, _portsPerDvPortGroup, 
null, false, BroadcastDomainType.Vlan, _vsmCredentials);
         }
 
         int nicIndex = allocPublicNicIndex(vmMo);
@@ -2356,7 +2357,7 @@ public class VmwareResource implements 
StoragePoolResource, ServerResource, Vmwa
             }
             networkInfo = HypervisorHostHelper.prepareNetwork(switchName, 
namePrefix, hostMo, vlanId, svlanId,
                     nicTo.getNetworkRateMbps(), 
nicTo.getNetworkRateMulticastMbps(), _opsTimeout, switchType,
-                    _portsPerDvPortGroup, nicTo.getGateway(), 
configureVServiceInNexus, nicTo.getBroadcastType());
+                    _portsPerDvPortGroup, nicTo.getGateway(), 
configureVServiceInNexus, nicTo.getBroadcastType(), _vsmCredentials);
         }
 
         return networkInfo;
@@ -4682,15 +4683,10 @@ public class VmwareResource implements 
StoragePoolResource, ServerResource, Vmwa
                 VmwareHypervisorHost hostMo = this.getHyperHost(context);
                 _hostName = hostMo.getHyperHostName();
 
-                Map<String, String> vsmCredentials;
                 if (_guestTrafficInfo.getVirtualSwitchType() == 
VirtualSwitchType.NexusDistributedVirtualSwitch ||
                         _publicTrafficInfo.getVirtualSwitchType() == 
VirtualSwitchType.NexusDistributedVirtualSwitch) {
-                    vsmCredentials = 
mgr.getNexusVSMCredentialsByClusterId(Long.parseLong(_cluster));
-                    if (vsmCredentials != null) {
-                        s_logger.info("Stocking credentials while configuring 
resource.");
-                        context.registerStockObject("vsmcredentials", 
vsmCredentials);
-                    }
                     _privateNetworkVSwitchName = 
mgr.getPrivateVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
+                    _vsmCredentials = 
mgr.getNexusVSMCredentialsByClusterId(Long.parseLong(_cluster));
                 }
 
             } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/96a6e673/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 f48f25f..a3a9d89 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
@@ -434,7 +434,7 @@ public class HypervisorHostHelper {
 
     public static Pair<ManagedObjectReference, String> prepareNetwork(String 
physicalNetwork, String namePrefix, HostMO hostMo, String vlanId, String 
secondaryvlanId,
             Integer networkRateMbps, Integer networkRateMulticastMbps, long 
timeOutMs, VirtualSwitchType vSwitchType, int numPorts, String gateway,
-            boolean configureVServiceInNexus, BroadcastDomainType 
broadcastDomainType) throws Exception {
+            boolean configureVServiceInNexus, BroadcastDomainType 
broadcastDomainType, Map<String, String> vsmCredentials) throws Exception {
         ManagedObjectReference morNetwork = null;
         VmwareContext context = hostMo.getContext();
         ManagedObjectReference dcMor = hostMo.getHyperHostDatacenter();
@@ -567,6 +567,10 @@ public class HypervisorHostHelper {
             long peakBandwidth = (long)(averageBandwidth * 1.5);
             // TODO(sateesh): Optionally let user specify the burst coefficient
             long burstSize = 5 * averageBandwidth / 8;
+            if (vsmCredentials != null) {
+                s_logger.info("Stocking credentials of Nexus VSM");
+                context.registerStockObject("vsmcredentials", vsmCredentials);
+            }
 
             if (!dataCenterMo.hasDvPortGroup(networkName)) {
                 s_logger.info("Port profile " + networkName + " not found.");

Reply via email to