use of org.btrplace.model.Node in project scheduler by btrplace.
the class AmongChecker method endsWith.
@Override
public boolean endsWith(Model i) {
Mapping map = i.getMapping();
Collection<Node> grp = null;
for (VM vm : getVMs()) {
if (map.isRunning(vm)) {
Collection<Node> nodes = getConstraint().getAssociatedPGroup(map.getVMLocation(vm));
if (nodes.isEmpty()) {
return false;
} else if (grp == null) {
grp = nodes;
} else if (!grp.equals(nodes)) {
return false;
}
}
}
return true;
}
use of org.btrplace.model.Node 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.Node 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.Node 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.Node 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;
}
Aggregations