CLOUDSTACK-8134. Worker VMs don't have MS id set in vCenter annotation 'cloud.vm.workertag'.

Correctly register node info for a newly created VMware context.
This commit is contained in:
Likitha Shetty 2014-12-30 11:48:06 +05:30
parent c7b23d0a10
commit 13bdc1cef4
1 changed files with 10 additions and 13 deletions

View File

@ -209,23 +209,20 @@ public class VmwareSecondaryStorageResourceHandler implements SecondaryStorageRe
_resource.ensureOutgoingRuleForAddress(vCenterAddress);
VmwareContext context = currentContext.get();
if (context != null) {
if(!context.validate()) {
invalidateServiceContext(context);
context = null;
} else {
context.registerStockObject("serviceconsole", cmd.getContextParam("serviceconsole"));
context.registerStockObject("manageportgroup", cmd.getContextParam("manageportgroup"));
context.registerStockObject("noderuninfo", cmd.getContextParam("noderuninfo"));
}
if (context != null && !context.validate()) {
invalidateServiceContext(context);
context = null;
}
if(context == null) {
s_logger.info("Open new VmwareContext. vCenter: " + vCenterAddress + ", user: " + username + ", password: " +
StringUtils.getMaskedPasswordForDisplay(password));
if (context == null) {
s_logger.info("Open new VmwareContext. vCenter: " + vCenterAddress + ", user: " + username + ", password: " + StringUtils.getMaskedPasswordForDisplay(password));
VmwareSecondaryStorageContextFactory.setVcenterSessionTimeout(vCenterSessionTimeout);
context = VmwareSecondaryStorageContextFactory.getContext(vCenterAddress, username, password);
}
if (context != null) {
context.registerStockObject("serviceconsole", cmd.getContextParam("serviceconsole"));
context.registerStockObject("manageportgroup", cmd.getContextParam("manageportgroup"));
context.registerStockObject("noderuninfo", cmd.getContextParam("noderuninfo"));
}
currentContext.set(context);
return context;
} catch (Exception e) {