From b0535d770d108ae219149b5a115c8953d89691d9 Mon Sep 17 00:00:00 2001 From: Sateesh Chodapuneedi Date: Wed, 14 Dec 2016 01:52:15 +0530 Subject: [PATCH] CLOUDSTACK-9676 Start instance fails after reverting to a VM snapshot, when there are child VM snapshots Issue ==== Start instance fails after reverting to a VM snapshot, when there is 1 or more child VM snapshots in the snapshot tree of the VM. Per the code that detects the presence of a snapshot, we are checking for only current snapshot instead of checking presence of any snapshot in the snapshot tree. The failure to detect all snapshots means ACP reconfigures the VM in wrong way assuming there are no snapshots for the VM. This results in start failure. Fix === Ensure correct detection of VM snapshots in the VM snapshot tree This closes #1828 Signed-off-by: Sateesh Chodapuneedi (cherry picked from commit 673bb25b5936d1c54e9210781280e9ddc507c830) Signed-off-by: Rohit Yadav --- .../com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java index 8b9d4e73bea..22c0b5a9e0a 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java @@ -661,7 +661,14 @@ public class VirtualMachineMO extends BaseMO { public boolean hasSnapshot() throws Exception { VirtualMachineSnapshotInfo info = getSnapshotInfo(); if (info != null) { - return info.getCurrentSnapshot() != null; + ManagedObjectReference currentSnapshot = info.getCurrentSnapshot(); + if (currentSnapshot != null) { + return true; + } + List rootSnapshotList = info.getRootSnapshotList(); + if (rootSnapshotList != null && rootSnapshotList.size() > 0) { + return true; + } } return false; }