Send StopCommand(Cleanup) if out-of-band power-off VM is detected.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/53f306e8 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/53f306e8 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/53f306e8 Branch: refs/heads/resize-root Commit: 53f306e8e20023eace74c3644a20be4066ca7ca9 Parents: 8ff9460 Author: Kelven Yang <[email protected]> Authored: Tue Mar 4 15:09:07 2014 -0800 Committer: Kelven Yang <[email protected]> Committed: Thu Mar 13 16:59:56 2014 -0700 ---------------------------------------------------------------------- .../src/com/cloud/vm/VirtualMachineManagerImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/53f306e8/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index 2cbde35..0ca0d30 100755 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -4221,6 +4221,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac case Stopped: case Migrating: s_logger.info("VM " + vm.getInstanceName() + " is at " + vm.getState() + " and we received a power-off report while there is no pending jobs on it"); + VirtualMachineGuru vmGuru = getVmGuru(vm); + VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm); + sendStop(vmGuru, profile, true); + try { stateTransitTo(vm, VirtualMachine.Event.FollowAgentPowerOffReport, null); } catch (NoTransitionException e) { @@ -4233,9 +4237,6 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac s_logger.info("VM " + vm.getInstanceName() + " is sync-ed to at Stopped state according to power-off report from hypervisor"); - VirtualMachineGuru vmGuru = getVmGuru(vm); - VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm); - sendStop(vmGuru, profile, true); break; case Destroyed:
