use of org.btrplace.model.VM in project scheduler by btrplace.
the class ActionTest method testBasics.
@Test
public void testBasics() {
Action a1 = new MockAction(new VM(1), 1, 3);
Assert.assertEquals(1, a1.getStart());
Assert.assertEquals(3, a1.getEnd());
Assert.assertTrue(a1.getEvents(Action.Hook.PRE).isEmpty());
Assert.assertTrue(a1.getEvents(Action.Hook.POST).isEmpty());
}
use of org.btrplace.model.VM 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.VM 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.VM 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.VM 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