mirror of https://github.com/apache/cloudstack.git
Don't allow success to be reported when we fail to stop vm due to no agent
connection BUG-ID: CLOUDSTACK-2195 Bugfix-for: 4.2 Reviewed-by: Edison Su Signed-off-by: Marcus Sorensen <marcus@betterservers.com> 1366950954 -0600
This commit is contained in:
parent
efb4471dc9
commit
f429c6687b
|
|
@ -2902,10 +2902,15 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
}
|
||||
|
||||
UserVO user = _userDao.findById(userId);
|
||||
|
||||
boolean status = false;
|
||||
try {
|
||||
VirtualMachineEntity vmEntity = _orchSrvc.getVirtualMachine(vm.getUuid());
|
||||
vmEntity.stop(new Long(userId).toString());
|
||||
status = vmEntity.stop(new Long(userId).toString());
|
||||
if (status) {
|
||||
return _vmDao.findById(vmId);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (ResourceUnavailableException e) {
|
||||
throw new CloudRuntimeException(
|
||||
"Unable to contact the agent to stop the virtual machine "
|
||||
|
|
@ -2915,8 +2920,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
"Unable to contact the agent to stop the virtual machine "
|
||||
+ vm, e);
|
||||
}
|
||||
|
||||
return _vmDao.findById(vmId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1136,7 +1136,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
vmGuru.finalizeStop(profile, answer);
|
||||
|
||||
} catch (AgentUnavailableException e) {
|
||||
s_logger.warn("Unable to stop vm, agent unavailable: " + e.toString());
|
||||
} catch (OperationTimedoutException e) {
|
||||
s_logger.warn("Unable to stop vm, operation timed out: " + e.toString());
|
||||
} finally {
|
||||
if (!stopped) {
|
||||
if (!forced) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue