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 Mon, 10 Jun 2019 13:53:24 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_r291849164
 
 

 ##########
 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)
{
+        _taggedResourceService = taggedResourceServiceMock;
+    }
+
+    public void setVmDao(UserVmDao userVmMock) {
 
 Review comment:
   fixed

----------------------------------------------------------------
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