mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Fixed vm-templates not being removed from primary storage with storag… (#4389)
* Fixed vm-templates not being removed from primary storage with storage garbage collection * Update vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java Co-authored-by: sureshanaparti <12028987+sureshanaparti@users.noreply.github.com> * Var name Co-authored-by: sureshanaparti <12028987+sureshanaparti@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									d3be14d4c8
								
							
						
					
					
						commit
						1bbb29d034
					
				| @ -6785,6 +6785,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa | |||||||
|                 if (s_logger.isInfoEnabled()) { |                 if (s_logger.isInfoEnabled()) { | ||||||
|                     s_logger.info("Destroy template volume " + vol.getPath()); |                     s_logger.info("Destroy template volume " + vol.getPath()); | ||||||
|                 } |                 } | ||||||
|  |                 vmMo.markAsVirtualMachine(hyperHost.getHyperHostOwnerResourcePool(), hyperHost.getMor()); | ||||||
|                 vmMo.destroy(); |                 vmMo.destroy(); | ||||||
|             } else { |             } else { | ||||||
|                 if (s_logger.isInfoEnabled()) { |                 if (s_logger.isInfoEnabled()) { | ||||||
|  | |||||||
| @ -541,7 +541,7 @@ public class VmwareStorageProcessor implements StorageProcessor { | |||||||
|                 // the same template may be deployed with multiple copies at per-datastore per-host basis, |                 // the same template may be deployed with multiple copies at per-datastore per-host basis, | ||||||
|                 // save the original template name from CloudStack DB as the UUID to associate them. |                 // save the original template name from CloudStack DB as the UUID to associate them. | ||||||
|                 vmMo.setCustomFieldValue(CustomFieldConstants.CLOUD_UUID, templateName); |                 vmMo.setCustomFieldValue(CustomFieldConstants.CLOUD_UUID, templateName); | ||||||
|                 if (vAppConfig == null) { |                 if (vAppConfig == null || (vAppConfig.getProperty().size() == 0)) { | ||||||
|                     vmMo.markAsTemplate(); |                     vmMo.markAsTemplate(); | ||||||
|                 } |                 } | ||||||
|             } else { |             } else { | ||||||
|  | |||||||
| @ -406,6 +406,10 @@ public class VirtualMachineMO extends BaseMO { | |||||||
|         _context.getService().markAsTemplate(_mor); |         _context.getService().markAsTemplate(_mor); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     public void markAsVirtualMachine(ManagedObjectReference resourcePool, ManagedObjectReference host) throws Exception { | ||||||
|  |         _context.getService().markAsVirtualMachine(_mor, resourcePool, host); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     public boolean isTemplate() throws Exception { |     public boolean isTemplate() throws Exception { | ||||||
|         VirtualMachineConfigInfo configInfo = getConfigInfo(); |         VirtualMachineConfigInfo configInfo = getConfigInfo(); | ||||||
|         return configInfo.isTemplate(); |         return configInfo.isTemplate(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user