Fix deploy-as-is templates GC

This commit is contained in:
nvazquez 2020-10-13 12:33:37 -03:00 committed by Harikrishna Patnala
parent 048e8c8744
commit 88c02efd27
1 changed files with 4 additions and 2 deletions

View File

@ -7165,11 +7165,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
VirtualMachineMO vmMo = findVmOnDatacenter(context, hyperHost, vol);
if (vmMo != null && vmMo.isTemplate()) {
if (vmMo != null) {
if (s_logger.isInfoEnabled()) {
s_logger.info("Destroy template volume " + vol.getPath());
}
vmMo.markAsVirtualMachine(hyperHost.getHyperHostOwnerResourcePool(), hyperHost.getMor());
if (vmMo.isTemplate()) {
vmMo.markAsVirtualMachine(hyperHost.getHyperHostOwnerResourcePool(), hyperHost.getMor());
}
vmMo.destroy();
} else {
if (s_logger.isInfoEnabled()) {