mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Pragrammatically Answer HA question posted in vCenter since it will block CloudStack from continuously operating on the VM
This commit is contained in:
parent
85adaf83c7
commit
4a414d3990
@ -190,10 +190,10 @@ public class VirtualMachineMO extends BaseMO {
|
||||
}
|
||||
|
||||
public boolean powerOn() throws Exception {
|
||||
if(getResetSafePowerState() == VirtualMachinePowerState.POWERED_ON)
|
||||
return true;
|
||||
if (getResetSafePowerState() == VirtualMachinePowerState.POWERED_ON)
|
||||
return true;
|
||||
|
||||
ManagedObjectReference morTask = _context.getService().powerOnVMTask(_mor, null);
|
||||
ManagedObjectReference morTask = _context.getService().powerOnVMTask(_mor, null);
|
||||
// Monitor VM questions
|
||||
final Boolean[] flags = {false};
|
||||
final VirtualMachineMO vmMo = this;
|
||||
@ -248,17 +248,12 @@ public class VirtualMachineMO extends BaseMO {
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
boolean result = _context.getVimClient().waitForTask(morTask);
|
||||
if (result) {
|
||||
_context.waitForTaskProgressDone(morTask);
|
||||
return true;
|
||||
} else {
|
||||
s_logger.error("VMware powerOnVM_Task failed due to " + TaskMO.getTaskFailureInfo(_context, morTask));
|
||||
}
|
||||
} finally {
|
||||
// make sure to let VM question monitor exit
|
||||
flags[0] = true;
|
||||
boolean result = _context.getVimClient().waitForTask(morTask);
|
||||
if (result) {
|
||||
_context.waitForTaskProgressDone(morTask);
|
||||
return true;
|
||||
} else {
|
||||
s_logger.error("VMware powerOnVM_Task failed due to " + TaskMO.getTaskFailureInfo(_context, morTask));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user