You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/05/28 07:54:55 UTC

[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #5043: Allow updating the storage/host tags of service offerings

DaanHoogland commented on a change in pull request #5043:
URL: https://github.com/apache/cloudstack/pull/5043#discussion_r641346071



##########
File path: server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
##########
@@ -3348,6 +3328,25 @@ protected void updateDiskOfferingTagsIfIsNotNull(String tags, DiskOfferingVO dis
         }
     }
 
+    /**
+     * Check the host tags parameters to the service offering
+     * <ul>
+     *     <li>If host tags is null, do nothing and return.</li>
+     *     <li>If host tags is not null, set host tag to the service offering.</li>
+     *     <li>If host tags is an blank string, set null on service offering tag.</li>
+     * </ul>
+     */
+    protected void updateServiceOfferingHostTagsIfNotNull(String hostTags, ServiceOfferingVO offering) {
+        if (hostTags == null) {
+            return;
+        }
+        if (StringUtils.isNotBlank(hostTags)) {
+            offering.setHostTag(hostTags);
+        } else {
+            offering.setHostTag(null);
+        }
+    }

Review comment:
       given this is identical to `updateOfferingTagsIfIsNotNull` in logic, I'd sugest creating a `TaggedVO` interface and unify the methods!?




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