CS-15010 Nexus vSwitch: Advanced Zone - System VMs failed to deploy due to Start Command Failure

CS-15016 SSH connections to VSM are not cleared [Once the connections are exceeded it failed to connect to VSM]
This commit is contained in:
Sateesh Chodapuneedi 2012-05-21 17:39:27 +05:30
parent 996e7746c8
commit b0ffdd5faa
5 changed files with 35 additions and 33 deletions

View File

@ -4020,8 +4020,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
mgr.setupResourceStartupParams(params);
CustomFieldsManagerMO cfmMo = new CustomFieldsManagerMO(context, context.getServiceContent().getCustomFieldsManager());
cfmMo.ensureCustomFieldDef("Datastore", CustomFieldConstants.CLOUD_UUID);
cfmMo.ensureCustomFieldDef("Network", CustomFieldConstants.CLOUD_GC);
cfmMo.ensureCustomFieldDef("Datastore", CustomFieldConstants.CLOUD_UUID);
if (mgr.getNexusVSwitchGlobalParameter()) {
cfmMo.ensureCustomFieldDef("DistributedVirtualPortgroup", CustomFieldConstants.CLOUD_GC_DVP);
} else {
cfmMo.ensureCustomFieldDef("Network", CustomFieldConstants.CLOUD_GC);
}
cfmMo.ensureCustomFieldDef("VirtualMachine", CustomFieldConstants.CLOUD_UUID);
cfmMo.ensureCustomFieldDef("VirtualMachine", CustomFieldConstants.CLOUD_NIC_MASK);

View File

@ -15,5 +15,6 @@ package com.cloud.hypervisor.vmware.mo;
public interface CustomFieldConstants {
public final static String CLOUD_UUID = "cloud.uuid";
public final static String CLOUD_GC = "cloud.gc";
public final static String CLOUD_GC_DVP = "cloud.gc.dvp";
public final static String CLOUD_NIC_MASK = "cloud.nic.mask";
}

View File

@ -443,31 +443,6 @@ public class DatacenterMO extends BaseMO {
public String getDvSwitchUuid(ManagedObjectReference dvSwitchMor) throws Exception {
assert (dvSwitchMor != null);
PropertySpec pSpec = new PropertySpec();
pSpec.setType("DistributedVirtualSwitch");
pSpec.setPathSet(new String[] { "uuid" });
ObjectSpec oSpec = new ObjectSpec();
oSpec.setObj(dvSwitchMor);
oSpec.setSkip(Boolean.FALSE);
oSpec.setSelectSet(new SelectionSpec[] {});
PropertyFilterSpec pfSpec = new PropertyFilterSpec();
pfSpec.setPropSet(new PropertySpec[] { pSpec });
pfSpec.setObjectSet(new ObjectSpec[] { oSpec });
ObjectContent[] ocs = _context.getService().retrieveProperties(
_context.getServiceContent().getPropertyCollector(),
new PropertyFilterSpec[] { pfSpec });
if (ocs != null) {
for (ObjectContent oc : ocs) {
DynamicProperty[] props = oc.getPropSet();
if (props != null) {
return (String) props[0].getVal();
}
}
}
return null;
return (String) _context.getServiceUtil().getDynamicProperty(dvSwitchMor, "uuid");
}
}

View File

@ -168,6 +168,10 @@ public class HypervisorHostHelper {
} catch (CloudRuntimeException e) {
msg = "Failed to modify ethernet port profile " + ethPortProfileName + " with parameters " + params.toString();
s_logger.error(msg);
if(netconfClient != null) {
netconfClient.disconnect();
s_logger.debug("Disconnected VSM session.");
}
throw new CloudRuntimeException(msg);
}
}
@ -180,6 +184,7 @@ public class HypervisorHostHelper {
s_logger.info("Adding port profile configured over VLAN : " + vlanId.toString());
netconfClient.addPortProfile(networkName, PortProfileType.vethernet, BindingType.portbindingstatic, SwitchPortMode.access, vlanId.intValue());
}
} catch (CloudRuntimeException e) {
msg = "Failed to add vEthernet port profile " + networkName + ". Exception: " + e.toString();
s_logger.error(msg);
@ -187,6 +192,11 @@ public class HypervisorHostHelper {
s_logger.warn("Ignoring exception : " + e.toString());
// throw new CloudRuntimeException(msg);
}
} finally {
if(netconfClient != null) {
netconfClient.disconnect();
s_logger.debug("Disconnected VSM session.");
}
}
}
@ -216,11 +226,16 @@ public class HypervisorHostHelper {
params.add(new Pair<OperationType, String>(OperationType.addvlanid, vlanId.toString()));
try {
netconfClient.updatePortProfile(ethPortProfileName, SwitchPortMode.access, params);
netconfClient.updatePortProfile(ethPortProfileName, SwitchPortMode.trunk, params);
} catch(CloudRuntimeException e) {
msg = "Failed to modify ethernet port profile " + ethPortProfileName + " with parameters " + params.toString();
s_logger.error(msg);
throw new CloudRuntimeException(msg);
} finally {
if(netconfClient != null) {
netconfClient.disconnect();
s_logger.debug("Disconnected VSM session.");
}
}
}
@ -331,7 +346,8 @@ public class HypervisorHostHelper {
if(createGCTag) {
NetworkMO networkMo = new NetworkMO(hostMo.getContext(), morNetwork);
networkMo.setCustomFieldValue(CustomFieldConstants.CLOUD_GC, "true");
networkMo.setCustomFieldValue(CustomFieldConstants.CLOUD_GC_DVP, "true");
s_logger.debug("Added custom field : " + CustomFieldConstants.CLOUD_GC_DVP);
}
return new Pair<ManagedObjectReference, String>(morNetwork, networkName);

View File

@ -648,7 +648,12 @@ public class VirtualMachineMO extends BaseMO {
public List<NetworkDetails> getNetworksWithDetails() throws Exception {
List<NetworkDetails> networks = new ArrayList<NetworkDetails>();
int gcTagKey = getCustomFieldKey("Network", CustomFieldConstants.CLOUD_GC);
int gcTagKey = getCustomFieldKey("Network", CustomFieldConstants.CLOUD_GC);
if(gcTagKey == 0) {
gcTagKey = getCustomFieldKey("DistributedVirtualPortgroup", CustomFieldConstants.CLOUD_GC_DVP);
s_logger.debug("The custom key for dvPortGroup is : " + gcTagKey);
}
PropertySpec pSpec = new PropertySpec();
pSpec.setType("Network");
@ -694,8 +699,9 @@ public class VirtualMachineMO extends BaseMO {
(morVms != null ? morVms.getManagedObjectReference() : null),
gcTagValue);
networks.add(details);
}
networks.add(details);
}
s_logger.debug("Retrieved " + networks.size() + " networks with key : " + gcTagKey);
}
return networks;