if (state == State.Running) {
synchronized (_vms) {
_vms.put(vmName, State.Running);
}
}
return new CheckVirtualMachineAnswer(cmd, state, vncPort);
} else {
s_logger.warn("Can not find vm " + vmName + " to execute CheckVirtualMachineCommand");
return new CheckVirtualMachineAnswer(cmd, state, vncPort);
}
} catch (Throwable e) {
if (e instanceof RemoteException) {
s_logger.warn("Encounter remote exception to vCenter, invalidate VMware session context");
invalidateServiceContext();
}
s_logger.error("Unexpected exception: " + VmwareHelper.getExceptionMessage(e), e);
return new CheckVirtualMachineAnswer(cmd, state, vncPort);
}
}