Skip to content

Commit 96a6e67

Browse files
author
Sateesh Chodapuneedi
committed
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 <sateesh@apache.org>
1 parent b5c1325 commit 96a6e67

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
299299
protected String _privateNetworkVSwitchName;
300300
protected VmwareTrafficLabel _guestTrafficInfo = new VmwareTrafficLabel(TrafficType.Guest);
301301
protected VmwareTrafficLabel _publicTrafficInfo = new VmwareTrafficLabel(TrafficType.Public);
302+
protected Map<String, String> _vsmCredentials = null;
302303
protected int _portsPerDvPortGroup;
303304
protected boolean _fullCloneFlag = false;
304305
protected boolean _instanceNameFlag = false;
@@ -1001,7 +1002,7 @@ private void plugPublicNic(VirtualMachineMO vmMo, final String vlanId, final Str
10011002
} else {
10021003
networkInfo =
10031004
HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(), "cloud.public", vmMo.getRunningHost(), vlanId, null, null, null,
1004-
_opsTimeout, vSwitchType, _portsPerDvPortGroup, null, false, BroadcastDomainType.Vlan);
1005+
_opsTimeout, vSwitchType, _portsPerDvPortGroup, null, false, BroadcastDomainType.Vlan, _vsmCredentials);
10051006
}
10061007

10071008
int nicIndex = allocPublicNicIndex(vmMo);
@@ -2356,7 +2357,7 @@ private Pair<ManagedObjectReference, String> prepareNetworkFromNicInfo(HostMO ho
23562357
}
23572358
networkInfo = HypervisorHostHelper.prepareNetwork(switchName, namePrefix, hostMo, vlanId, svlanId,
23582359
nicTo.getNetworkRateMbps(), nicTo.getNetworkRateMulticastMbps(), _opsTimeout, switchType,
2359-
_portsPerDvPortGroup, nicTo.getGateway(), configureVServiceInNexus, nicTo.getBroadcastType());
2360+
_portsPerDvPortGroup, nicTo.getGateway(), configureVServiceInNexus, nicTo.getBroadcastType(), _vsmCredentials);
23602361
}
23612362

23622363
return networkInfo;
@@ -4682,15 +4683,10 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
46824683
VmwareHypervisorHost hostMo = this.getHyperHost(context);
46834684
_hostName = hostMo.getHyperHostName();
46844685

4685-
Map<String, String> vsmCredentials;
46864686
if (_guestTrafficInfo.getVirtualSwitchType() == VirtualSwitchType.NexusDistributedVirtualSwitch ||
46874687
_publicTrafficInfo.getVirtualSwitchType() == VirtualSwitchType.NexusDistributedVirtualSwitch) {
4688-
vsmCredentials = mgr.getNexusVSMCredentialsByClusterId(Long.parseLong(_cluster));
4689-
if (vsmCredentials != null) {
4690-
s_logger.info("Stocking credentials while configuring resource.");
4691-
context.registerStockObject("vsmcredentials", vsmCredentials);
4692-
}
46934688
_privateNetworkVSwitchName = mgr.getPrivateVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
4689+
_vsmCredentials = mgr.getNexusVSMCredentialsByClusterId(Long.parseLong(_cluster));
46944690
}
46954691

46964692
} catch (Exception e) {

vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ public static void updatePortProfile(VmwareContext context, String ethPortProfil
434434

435435
public static Pair<ManagedObjectReference, String> prepareNetwork(String physicalNetwork, String namePrefix, HostMO hostMo, String vlanId, String secondaryvlanId,
436436
Integer networkRateMbps, Integer networkRateMulticastMbps, long timeOutMs, VirtualSwitchType vSwitchType, int numPorts, String gateway,
437-
boolean configureVServiceInNexus, BroadcastDomainType broadcastDomainType) throws Exception {
437+
boolean configureVServiceInNexus, BroadcastDomainType broadcastDomainType, Map<String, String> vsmCredentials) throws Exception {
438438
ManagedObjectReference morNetwork = null;
439439
VmwareContext context = hostMo.getContext();
440440
ManagedObjectReference dcMor = hostMo.getHyperHostDatacenter();
@@ -567,6 +567,10 @@ public static Pair<ManagedObjectReference, String> prepareNetwork(String physica
567567
long peakBandwidth = (long)(averageBandwidth * 1.5);
568568
// TODO(sateesh): Optionally let user specify the burst coefficient
569569
long burstSize = 5 * averageBandwidth / 8;
570+
if (vsmCredentials != null) {
571+
s_logger.info("Stocking credentials of Nexus VSM");
572+
context.registerStockObject("vsmcredentials", vsmCredentials);
573+
}
570574

571575
if (!dataCenterMo.hasDvPortGroup(networkName)) {
572576
s_logger.info("Port profile " + networkName + " not found.");

0 commit comments

Comments
 (0)