use of org.btrplace.model.Node in project scheduler by btrplace.
the class RunningCapacityChecker method endsWith.
@Override
public boolean endsWith(Model mo) {
int nb = 0;
Mapping map = mo.getMapping();
for (Node n : getNodes()) {
nb += map.getRunningVMs(n).size();
if (nb > qty) {
return false;
}
}
return true;
}
use of org.btrplace.model.Node in project scheduler by btrplace.
the class ResourceCapacityChecker method endsWith.
@Override
public boolean endsWith(Model i) {
ShareableResource r = ShareableResource.get(i, getConstraint().getResource());
if (r == null) {
return false;
}
int remainder = getConstraint().getAmount();
for (Node id : getNodes()) {
if (i.getMapping().isOnline(id)) {
remainder -= r.sumConsumptions(i.getMapping().getRunningVMs(id), true);
if (remainder < 0) {
return false;
}
}
}
return true;
}
use of org.btrplace.model.Node in project scheduler by btrplace.
the class ResourceCapacityChecker method startsWith.
@Override
public boolean startsWith(Model mo) {
if (getConstraint().isContinuous()) {
rc = ShareableResource.get(mo, getConstraint().getResource());
free = getConstraint().getAmount();
Mapping map = mo.getMapping();
for (Node n : getNodes()) {
free -= rc.sumConsumptions(map.getRunningVMs(n), true);
if (free < 0) {
return false;
}
}
}
return true;
}
use of org.btrplace.model.Node in project scheduler by btrplace.
the class SeqChecker method startsWith.
@Override
public boolean startsWith(Model mo) {
running = new HashSet<>();
for (Node n : mo.getMapping().getOnlineNodes()) {
running.addAll(mo.getMapping().getRunningVMs(n));
}
track(running);
return true;
}
use of org.btrplace.model.Node in project scheduler by btrplace.
the class SpreadChecker method endsWith.
@Override
public boolean endsWith(Model mo) {
Set<Node> forbidden = new HashSet<>();
Mapping map = mo.getMapping();
for (VM vm : getVMs()) {
if (map.isRunning(vm) && !forbidden.add(map.getVMLocation(vm))) {
return false;
}
}
return true;
}
Aggregations