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 2020/12/10 08:30:51 UTC
[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #4399: PR multi tags in host offering [#4398]
DaanHoogland commented on a change in pull request #4399:
URL: https://github.com/apache/cloudstack/pull/4399#discussion_r539970205
##########
File path: engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java
##########
@@ -480,6 +482,25 @@ public Integer countAllByTypeInZone(long zoneId, Type type) {
return listBy(sc);
}
+ @Override
+ public boolean checkHostServiceOfferingTags(HostVO host, ServiceOffering serviceOffering){
+ if (host == null) {
+ return false;
+ }
+ if (serviceOffering == null) {
+ return false;
+ }
+ if (Strings.isNullOrEmpty(serviceOffering.getHostTag())) {
+ return true;
+ }
+
+ List<String> serviceOfferingTags = Arrays.asList(serviceOffering.getHostTag().split(","));
+ if(host.getHostTags() != null && host.getHostTags().containsAll(serviceOfferingTags)){
+ return true;
+ }
+ return false;
+ }
Review comment:
trying to isolate this check is fine but the DAO is for DB interaction, and this is really business logic. personally I would make it a default method for the Host interface, but a member of HostVO could also be.
Can you (shortly) explain why you put it here, @DK101010 ?
----------------------------------------------------------------
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