if (userVm == null)
return false;
List<VMSnapshotVO> vmSnapshotsInExpungingStates = _vmSnapshotDao.listByInstanceId(vm.getId(), VMSnapshot.State.Expunging, VMSnapshot.State.Reverting, VMSnapshot.State.Creating);
for (VMSnapshotVO vmSnapshotVO : vmSnapshotsInExpungingStates) {
VMSnapshotStrategy strategy = findVMSnapshotStrategy(vmSnapshotVO);
if (vmSnapshotVO.getState() == VMSnapshot.State.Expunging) {
return strategy.deleteVMSnapshot(vmSnapshotVO);
} else if (vmSnapshotVO.getState() == VMSnapshot.State.Creating) {
return strategy.takeVMSnapshot(vmSnapshotVO) != null;
} else if (vmSnapshotVO.getState() == VMSnapshot.State.Reverting) {
return strategy.revertVMSnapshot(vmSnapshotVO);
}
}
} catch (Exception e) {
s_logger.error(e.getMessage(), e);
if (_vmSnapshotDao.listByInstanceId(vm.getId(), VMSnapshot.State.Expunging).size() == 0)