bug 11386: check host status before responding StartupCommand

This commit is contained in:
Kelven Yang 2011-09-08 17:39:59 -07:00
parent a0ab06b186
commit 968c1d11ea
1 changed files with 16 additions and 1 deletions

View File

@ -2960,7 +2960,22 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
}
@Override
public StartupCommand[] initialize() {
public StartupCommand[] initialize() {
VmwareContext context = getServiceContext();
try {
VmwareHypervisorHost hyperHost = getHyperHost(context);
assert(hyperHost instanceof HostMO);
if(!((HostMO)hyperHost).isHyperHostConnected()) {
s_logger.info("Host " + hyperHost.getHyperHostName() + " is not in connected state");
return null;
}
} catch (Exception e) {
String msg = "VmwareResource intialize() failed due to : " + VmwareHelper.getExceptionMessage(e);
s_logger.error(msg);
invalidateServiceContext();
return null;
}
StartupRoutingCommand cmd = new StartupRoutingCommand();
fillHostInfo(cmd);