Example #1
0
 private boolean hostSatisfiesHostAffinity(long hostId, List<Constraint> hostAffinityConstraints) {
   for (Constraint constraint : hostAffinityConstraints) {
     AllocationCandidate candidate = new AllocationCandidate();
     candidate.setHost(hostId);
     if (!constraint.matches(candidate)) {
       return false;
     }
   }
   return true;
 }
Example #2
0
 private boolean hostSatisfiesHostAffinity(long hostId, List<Constraint> hostAffinityConstraints) {
   for (Constraint constraint : hostAffinityConstraints) {
     AllocationCandidate candidate = new AllocationCandidate();
     Set<Long> hostIds = new HashSet<Long>();
     hostIds.add(hostId);
     candidate.setHosts(hostIds);
     if (!constraint.matches(null, candidate)) {
       return false;
     }
   }
   return true;
 }