Skip to content

Commit 523cbdd

Browse files
koushik-daschaturvedia
authored andcommitted
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 775fa0f) Signed-off-by: Animesh Chaturvedi <animesh@apache.org>
1 parent d7e1d38 commit 523cbdd

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,6 +1529,11 @@ private void setStateMachine() {
15291529
}
15301530

15311531
protected boolean stateTransitTo(VMInstanceVO vm, VirtualMachine.Event e, Long hostId, String reservationId) throws NoTransitionException {
1532+
// if there are active vm snapshots task, state change is not allowed
1533+
if (_vmSnapshotMgr.hasActiveVMSnapshotTasks(vm.getId())) {
1534+
s_logger.error("State transit with event: " + e + " failed due to: " + vm.getInstanceName() + " has active VM snapshots tasks");
1535+
return false;
1536+
}
15321537
vm.setReservationId(reservationId);
15331538
return _stateMachine.transitTo(vm, e, new Pair<Long, Long>(vm.getHostId(), hostId), _vmDao);
15341539
}

0 commit comments

Comments
 (0)