From 523cbdda687f259fd0bee7e6b79fa0fb035fc990 Mon Sep 17 00:00:00 2001 From: Koushik Das Date: Thu, 30 Jan 2014 18:07:24 +0530 Subject: [PATCH] CLOUDSTACK-5989: Trying to start a vm while 'vm snapshot' is in progress results in inconsistency The fix is to fail the start operation if a vm snapshot is in progress (cherry picked from commit 775fa0f0d02f182e3cba02faed569272b00e9926) Signed-off-by: Animesh Chaturvedi --- .../src/com/cloud/vm/VirtualMachineManagerImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index 6dc58944d07..e5333867758 100755 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -1529,6 +1529,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } protected boolean stateTransitTo(VMInstanceVO vm, VirtualMachine.Event e, Long hostId, String reservationId) throws NoTransitionException { + // if there are active vm snapshots task, state change is not allowed + if (_vmSnapshotMgr.hasActiveVMSnapshotTasks(vm.getId())) { + s_logger.error("State transit with event: " + e + " failed due to: " + vm.getInstanceName() + " has active VM snapshots tasks"); + return false; + } vm.setReservationId(reservationId); return _stateMachine.transitTo(vm, e, new Pair(vm.getHostId(), hostId), _vmDao); }