mirror of https://github.com/apache/cloudstack.git
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:
parent
67aa34f46d
commit
e790059a34
|
|
@ -569,8 +569,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);
|
||||
}
|
||||
|
|
@ -718,8 +720,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue