rhtyd commented on a change in pull request #3297: Support copy tags from 
template/iso image to VM from deploy vm command
URL: https://github.com/apache/cloudstack/pull/3297#discussion_r299798947
 
 

 ##########
 File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
 ##########
 @@ -4931,6 +4936,15 @@ public UserVm createVirtualMachine(DeployVMCmd cmd) 
throws InsufficientCapacityE
             addExtraConfig(vm, caller, extraConfig);
         }
 
+        if (cmd.getCopyImageTagsToVm()) {
+            final ResourceTag.ResourceObjectType templateType = 
(_templateDao.findById(templateId).getFormat() == ImageFormat.ISO) ? 
ResourceTag.ResourceObjectType.ISO : ResourceTag.ResourceObjectType.Template;
 
 Review comment:
   Potential NPE case, please make the code defensive:
   - Find the template/iso using the templateId
   - Check for nullity and then proceed with the logic/code

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