cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [cloudstack] matheusdaluz commented on a change in pull request #3389: when destroy the vms, delete the tags from virtual router
Date Sun, 09 Jun 2019 12:35:25 GMT
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_r291836058
 
 

 ##########
 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.");
 
 Review comment:
   Yes, if someone would like debug the method and i need send a void map to method work.


----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message