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 f45e6b94ed)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Likitha Shetty 2015-03-12 14:32:58 +05:30 committed by Rohit Yadav
parent 681d8c0518
commit db379bf0e8
2 changed files with 1 additions and 12 deletions

View File

@ -5148,7 +5148,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
ClusterMO clusterMo = new ClusterMO(context, morCluster);
VirtualMachineMO vmMo = clusterMo.findVmOnHyperHost(vol.getPath());
if (vmMo != null) {
if (vmMo != null && vmMo.isTemplate()) {
if (s_logger.isInfoEnabled()) {
s_logger.info("Destroy template volume " + vol.getPath());
}

View File

@ -1679,17 +1679,6 @@ public class VmwareStorageProcessor implements StorageProcessor {
if (s_logger.isInfoEnabled()) {
s_logger.info("Destroy root volume directly from datastore");
}
} else {
// evitTemplate will be converted into DestroyCommand, test if we are running in this case
VirtualMachineMO vmMo = clusterMo.findVmOnHyperHost(vol.getPath());
if (vmMo != null) {
if (s_logger.isInfoEnabled()) {
s_logger.info("Destroy template volume " + vol.getPath());
}
vmMo.destroy();
return new Answer(cmd, true, "Success");
}
}
VmwareStorageLayoutHelper.deleteVolumeVmdkFiles(dsMo, vol.getPath(), new DatacenterMO(context, morDc));