Skip to content

Commit db379bf

Browse files
Likitha Shettyyadvr
authored andcommitted
CLOUDSTACK-8405: Restore VM results in deletion of data disk.
Dont evict template when a delete command has been sent to VMware resource for deletion of volume. (cherry picked from commit f45e6b9) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 681d8c0 commit db379bf

2 files changed

Lines changed: 1 addition & 12 deletions

File tree

‎plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5148,7 +5148,7 @@ public Answer execute(DestroyCommand cmd) {
51485148
ClusterMO clusterMo = new ClusterMO(context, morCluster);
51495149

51505150
VirtualMachineMO vmMo = clusterMo.findVmOnHyperHost(vol.getPath());
5151-
if (vmMo != null) {
5151+
if (vmMo != null && vmMo.isTemplate()) {
51525152
if (s_logger.isInfoEnabled()) {
51535153
s_logger.info("Destroy template volume " + vol.getPath());
51545154
}

‎plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,17 +1679,6 @@ public Answer deleteVolume(DeleteCommand cmd) {
16791679
if (s_logger.isInfoEnabled()) {
16801680
s_logger.info("Destroy root volume directly from datastore");
16811681
}
1682-
} else {
1683-
// evitTemplate will be converted into DestroyCommand, test if we are running in this case
1684-
VirtualMachineMO vmMo = clusterMo.findVmOnHyperHost(vol.getPath());
1685-
if (vmMo != null) {
1686-
if (s_logger.isInfoEnabled()) {
1687-
s_logger.info("Destroy template volume " + vol.getPath());
1688-
}
1689-
1690-
vmMo.destroy();
1691-
return new Answer(cmd, true, "Success");
1692-
}
16931682
}
16941683

16951684
VmwareStorageLayoutHelper.deleteVolumeVmdkFiles(dsMo, vol.getPath(), new DatacenterMO(context, morDc));

0 commit comments

Comments
 (0)