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 67aa34f46d
commit e790059a34
1 changed files with 8 additions and 4 deletions

View File

@ -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();
}
}
}