DK101010 commented on a change in pull request #4399:
URL: https://github.com/apache/cloudstack/pull/4399#discussion_r540014313
##########
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:
Hi,
In the HostDaoImpl there are a couple of other methods that are check host
tags, therefore i thought will be good to add this also here. So will be
encapsulate common logic in one class, but my experience is still not very well
in CS and when it destroy other guidelines then will be also ok to move this
method. For me sounds HostVO good, because it seems to be only relevant for
this object.
----------------------------------------------------------------
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:
[email protected]