matheusdaluz commented on a change in pull request #3389: when destroy the vms, 
delete the tags from virtual router
URL: https://github.com/apache/cloudstack/pull/3389#discussion_r291849360
 
 

 ##########
 File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
 ##########
 @@ -2818,6 +2822,26 @@ public UserVm destroyVm(DestroyVMCmd cmd) throws 
ResourceUnavailableException, C
         return destroyedVm;
     }
 
+    protected void removeTagsFromVm(long vmId) {
+        UserVmVO vm = _vmDao.findById(vmId);
+        Long resourceId = _taggedResourceService.getResourceId(vm.getUuid(), 
ResourceTag.ResourceObjectType.UserVm);
+        List<? extends ResourceTag> resourceTags = 
_taggedResourceService.listByResourceTypeAndId(ResourceTag.ResourceObjectType.UserVm,
 resourceId);
+        if (resourceTags.size() > 0) {
+            List<String> resourceIds = Arrays.asList(vm.getUuid());
+            Map<String, String> tags = new HashMap<>();
+            _taggedResourceService.deleteTags(resourceIds, 
ResourceTag.ResourceObjectType.UserVm, tags);
+            s_logger.debug("Tags from vm id: " + vmId + " has been removed.");
+        }
+    }
+
+    public void setTaggedResourceService(TaggedResourceService 
taggedResourceServiceMock) {
 
 Review comment:
   to mock tests
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to