bug 12039, 12041: detach all disks before destroy worker VM to avoid accidentally delete the underlying disk along with the worker VM. Reviewed-by: Kelven

This commit is contained in:
Kelven Yang 2011-11-15 19:04:54 -08:00
parent 37908d2669
commit 67a2320001

View File

@ -507,8 +507,10 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
return new Ternary<String, Long, Long>(installPath + "/" + templateName + ".ova", size, size);
} finally {
if(clonedVm != null)
clonedVm.destroy();
if(clonedVm != null) {
clonedVm.detachAllDisks();
clonedVm.destroy();
}
vmMo.removeSnapshot(tmpSnapshotName, false);
}
@ -656,8 +658,10 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
clonedVm.moveAllVmDiskFiles(primaryDsMo, "", false);
clonedVm.detachAllDisks();
} finally {
if(clonedVm != null)
clonedVm.destroy();
if(clonedVm != null) {
clonedVm.detachAllDisks();
clonedVm.destroy();
}
}
}