use of org.btrplace.model.Mapping in project scheduler by btrplace.
the class CSleeping method getMisPlacedVMs.
@Override
public Set<VM> getMisPlacedVMs(Instance i) {
VM v = cstr.getInvolvedVMs().iterator().next();
Mapping map = i.getModel().getMapping();
if (!map.isSleeping(v)) {
return Collections.singleton(v);
}
return Collections.emptySet();
}
use of org.btrplace.model.Mapping in project scheduler by btrplace.
the class CSplit method fullfillOthers.
private static void fullfillOthers(ReconfigurationProblem rp, TIntArrayList[] otherPositions, List<IntVar>[] otherEnds, List<List<VM>> vmGroups) {
Mapping map = rp.getSourceModel().getMapping();
// Fulfill the others stuff.
for (int i = 0; i < vmGroups.size(); i++) {
List<VM> grp = vmGroups.get(i);
for (VM vm : grp) {
if (map.isRunning(vm)) {
int myPos = rp.getNode(map.getVMLocation(vm));
IntVar myEnd = rp.getVMAction(vm).getCSlice().getEnd();
for (int j = 0; j < vmGroups.size(); j++) {
if (i != j) {
otherPositions[j].add(myPos);
otherEnds[j].add(myEnd);
}
}
}
}
}
}
use of org.btrplace.model.Mapping in project scheduler by btrplace.
the class ExamplesTest method testExample.
@Test
public void testExample() throws ScriptBuilderException {
// Set the environment
Model mo = new DefaultModel();
// Make the builder and add the sources location to the include path
ScriptBuilder scrBuilder = new ScriptBuilder(mo);
((PathBasedIncludes) scrBuilder.getIncludes()).addPath(new File("src/test/resources/org/btrplace/btrpsl/examples"));
// Parse myApp.btrp
Script myApp = scrBuilder.build(new File("src/test/resources/org/btrplace/btrpsl/examples/myApp.btrp"));
Assert.assertEquals(myApp.getVMs().size(), 24);
Assert.assertEquals(myApp.getNodes().size(), 0);
Assert.assertEquals(myApp.getConstraints().size(), 5);
// Check the resulting mapping
Mapping map = mo.getMapping();
Assert.assertEquals(map.getReadyVMs().size(), 24);
Assert.assertEquals(map.getOfflineNodes().size(), 251);
}
Aggregations