예제 #1
0
 private boolean discreteCheck(Model mo) {
   Mapping map = mo.getMapping();
   for (VM vm : getVMs()) {
     if (map.isRunning(vm)) {
       Node host = map.getVMLocation(vm);
       Set<VM> on = map.getRunningVMs(host);
       // Check for other VMs on the node. If they are not in the constraint
       // it's a violation
       for (VM vm2 : on) {
         if (!vm2.equals(vm) && !getVMs().contains(vm2)) {
           return false;
         }
       }
     }
   }
   return true;
 }
예제 #2
0
 @Override
 public boolean startsWith(Model mo) {
   if (getConstraint().isContinuous()) {
     boolean ret = discreteCheck(mo);
     if (ret) {
       Mapping map = mo.getMapping();
       for (VM vm : getVMs()) {
         if (map.isRunning(vm)) {
           privateNodes.add(map.getVMLocation(vm));
         }
       }
       for (Node n : map.getOnlineNodes()) {
         if (map.getRunningVMs(n).isEmpty()) {
           idleNodes.add(n);
         }
       }
     }
     return ret;
   }
   return true;
 }