Skip to content

Commit 4a414d3

Browse files
committed
Pragrammatically Answer HA question posted in vCenter since it will block CloudStack from continuously operating on the VM
1 parent 85adaf8 commit 4a414d3

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,10 @@ public boolean isVMwareToolsRunning() throws Exception {
190190
}
191191

192192
public boolean powerOn() throws Exception {
193-
if(getResetSafePowerState() == VirtualMachinePowerState.POWERED_ON)
194-
return true;
193+
if (getResetSafePowerState() == VirtualMachinePowerState.POWERED_ON)
194+
return true;
195195

196-
ManagedObjectReference morTask = _context.getService().powerOnVMTask(_mor, null);
196+
ManagedObjectReference morTask = _context.getService().powerOnVMTask(_mor, null);
197197
// Monitor VM questions
198198
final Boolean[] flags = {false};
199199
final VirtualMachineMO vmMo = this;
@@ -248,17 +248,12 @@ public void run() {
248248
}
249249
});
250250

251-
try {
252-
boolean result = _context.getVimClient().waitForTask(morTask);
253-
if (result) {
254-
_context.waitForTaskProgressDone(morTask);
255-
return true;
256-
} else {
257-
s_logger.error("VMware powerOnVM_Task failed due to " + TaskMO.getTaskFailureInfo(_context, morTask));
258-
}
259-
} finally {
260-
// make sure to let VM question monitor exit
261-
flags[0] = true;
251+
boolean result = _context.getVimClient().waitForTask(morTask);
252+
if (result) {
253+
_context.waitForTaskProgressDone(morTask);
254+
return true;
255+
} else {
256+
s_logger.error("VMware powerOnVM_Task failed due to " + TaskMO.getTaskFailureInfo(_context, morTask));
262257
}
263258

264259
return false;

0 commit comments

Comments
 (0)