use of org.btrplace.model.constraint.Overbook in project scheduler by btrplace.
the class COverbookTest method testWithScheduling1.
@Test
public void testWithScheduling1() throws SchedulerException {
Model mo = new DefaultModel();
VM vm1 = mo.newVM();
VM vm3 = mo.newVM();
Node n1 = mo.newNode();
Mapping m = mo.getMapping().on(n1).run(n1, vm1).ready(vm3);
ShareableResource rcCPU = new ShareableResource("cpu", 2, 2);
List<SatConstraint> cstrs = new ArrayList<>();
cstrs.add(new Running(vm3));
cstrs.add(new Sleeping(vm1));
cstrs.addAll(Online.newOnline(m.getAllNodes()));
cstrs.add(new Overbook(n1, "cpu", 1));
cstrs.add(new Preserve(vm1, "cpu", 2));
cstrs.add(new Preserve(vm3, "cpu", 2));
mo.attach(rcCPU);
ChocoScheduler cra = new DefaultChocoScheduler();
ReconfigurationPlan p = cra.solve(mo, cstrs);
Assert.assertNotNull(p);
}
Aggregations