shwstppr commented on code in PR #10603:
URL: https://github.com/apache/cloudstack/pull/10603#discussion_r2009434593


##########
plugins/host-allocators/random/src/main/java/com/cloud/agent/manager/allocator/impl/RandomAllocator.java:
##########
@@ -94,15 +94,15 @@ private List<Host> findSuitableHosts(VirtualMachineProfile 
vmProfile, Deployment
             return suitableHosts;
         }
         String offeringHostTag = offering.getHostTag();
+
         VMTemplateVO template = (VMTemplateVO)vmProfile.getTemplate();
         String templateTag = template.getTemplateTag();
         String hostTag = null;
         if (ObjectUtils.anyNull(offeringHostTag, templateTag)) {
             hostTag = offeringHostTag;
-            hostTag = hostTag == null ? templateTag : String.format("%s, %s", 
hostTag, templateTag);
-            logger.debug(String.format("Looking for hosts in dc [%s], pod 
[%s], cluster [%s] and complying with host tag(s): [%s]", dcId, podId, 
clusterId, hostTag));
+            logger.debug("Looking for hosts in dc [{}], pod [{}], cluster [{}] 
and complying with host tag(s): [{}]", dcId, podId, clusterId, hostTag);

Review Comment:
   This should be something like,
   
   ```
           if (ObjectUtils.anyNotNull(offeringHostTag, templateTag)) {
               hostTag = ObjectUtils.allNotNull(offeringHostTag, templateTag) ?
                       String.format("%s, %s", hostTag, templateTag) :
                       ObjectUtils.firstNonNull(offeringHostTag, templateTag);
               logger.debug("Looking for hosts in dc [{}], pod [{}], cluster 
[{}] and complying with host tag(s): [{}]", dcId, podId, clusterId, hostTag);



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to