Search in sources :

Example 11 with Overbook

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);
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) Node(org.btrplace.model.Node) SatConstraint(org.btrplace.model.constraint.SatConstraint) ReconfigurationPlan(org.btrplace.plan.ReconfigurationPlan) ArrayList(java.util.ArrayList) Mapping(org.btrplace.model.Mapping) ShareableResource(org.btrplace.model.view.ShareableResource) Preserve(org.btrplace.model.constraint.Preserve) DefaultChocoScheduler(org.btrplace.scheduler.choco.DefaultChocoScheduler) ChocoScheduler(org.btrplace.scheduler.choco.ChocoScheduler) Sleeping(org.btrplace.model.constraint.Sleeping) DefaultChocoScheduler(org.btrplace.scheduler.choco.DefaultChocoScheduler) BootVM(org.btrplace.plan.event.BootVM) VM(org.btrplace.model.VM) ShutdownVM(org.btrplace.plan.event.ShutdownVM) Overbook(org.btrplace.model.constraint.Overbook) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Running(org.btrplace.model.constraint.Running) Test(org.testng.annotations.Test)

Aggregations

Overbook (org.btrplace.model.constraint.Overbook)11 DefaultModel (org.btrplace.model.DefaultModel)10 Test (org.testng.annotations.Test)10 Model (org.btrplace.model.Model)9 Node (org.btrplace.model.Node)9 SatConstraint (org.btrplace.model.constraint.SatConstraint)8 VM (org.btrplace.model.VM)7 Preserve (org.btrplace.model.constraint.Preserve)7 ShareableResource (org.btrplace.model.view.ShareableResource)7 Mapping (org.btrplace.model.Mapping)6 BootVM (org.btrplace.plan.event.BootVM)6 ShutdownVM (org.btrplace.plan.event.ShutdownVM)6 DefaultChocoScheduler (org.btrplace.scheduler.choco.DefaultChocoScheduler)6 HashSet (java.util.HashSet)5 ReconfigurationPlan (org.btrplace.plan.ReconfigurationPlan)5 ArrayList (java.util.ArrayList)4 ChocoScheduler (org.btrplace.scheduler.choco.ChocoScheduler)4 Instance (org.btrplace.model.Instance)2 MinMTTR (org.btrplace.model.constraint.MinMTTR)2 TObjectIntMap (gnu.trove.map.TObjectIntMap)1