use of org.btrplace.model.Mapping in project scheduler by btrplace.
the class GatherChecker method endsWith.
@Override
public boolean endsWith(Model mo) {
Node used = null;
Mapping map = mo.getMapping();
for (VM vm : getVMs()) {
if (map.isRunning(vm)) {
if (used == null) {
used = map.getVMLocation(vm);
} else if (used != map.getVMLocation(vm)) {
return false;
}
}
}
return true;
}
use of org.btrplace.model.Mapping in project scheduler by btrplace.
the class LonelyChecker method discreteCheck.
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);
// it's a violation
for (VM vm2 : on) {
if (!vm2.equals(vm) && !getVMs().contains(vm2)) {
return false;
}
}
}
}
return true;
}
use of org.btrplace.model.Mapping in project scheduler by btrplace.
the class MaxOnlineChecker method endsWith.
@Override
public boolean endsWith(Model mo) {
Mapping map = mo.getMapping();
int on = 0;
for (Node n : getConstraint().getInvolvedNodes()) {
if (map.isOnline(n)) {
on++;
}
}
return on <= getConstraint().getAmount();
}
use of org.btrplace.model.Mapping in project scheduler by btrplace.
the class OverbookChecker method endsWith.
@Override
public boolean endsWith(Model i) {
Mapping cfg = i.getMapping();
ShareableResource rc = ShareableResource.get(i, id);
if (rc == null) {
return false;
}
for (Node nId : getNodes()) {
if (cfg.isOnline(nId)) {
// Server capacity with the ratio
double c = rc.getCapacity(nId) * ratio;
// Minus the VMs usage
for (VM vmId : cfg.getRunningVMs(nId)) {
c -= rc.getConsumption(vmId);
if (c < 0) {
return false;
}
}
}
}
return true;
}
use of org.btrplace.model.Mapping in project scheduler by btrplace.
the class RunningCapacityChecker method startsWith.
@Override
public boolean startsWith(Model mo) {
if (getConstraint().isContinuous()) {
int nb = 0;
Mapping map = mo.getMapping();
for (Node n : getNodes()) {
nb += map.getRunningVMs(n).size();
if (nb > qty) {
return false;
}
}
srcRunning = new HashSet<>();
for (Node n : map.getOnlineNodes()) {
srcRunning.addAll(map.getRunningVMs(n));
}
track(srcRunning);
}
return true;
}
Aggregations