use of org.btrplace.scheduler.choco.ChocoScheduler in project scheduler by btrplace.
the class CGatherTest method testContinuousWithRelocationOfVMs.
/**
* We try to relocate co-located VMs in continuous mode. Not allowed
*
* @throws org.btrplace.scheduler.SchedulerException
*/
@Test
public void testContinuousWithRelocationOfVMs() throws SchedulerException {
Model mo = new DefaultModel();
VM vm1 = mo.newVM();
VM vm2 = mo.newVM();
Node n1 = mo.newNode();
Node n2 = mo.newNode();
Mapping map = mo.getMapping().on(n1, n2).run(n2, vm1, vm2);
Gather g = new Gather(map.getAllVMs());
g.setContinuous(true);
List<SatConstraint> cstrs = new ArrayList<>();
cstrs.addAll(Running.newRunning(map.getAllVMs()));
cstrs.add(g);
cstrs.add(new Fence(vm1, Collections.singleton(n1)));
cstrs.add(new Fence(vm2, Collections.singleton(n1)));
ChocoScheduler cra = new DefaultChocoScheduler();
ReconfigurationPlan plan = cra.solve(mo, cstrs);
Assert.assertNull(plan);
}
use of org.btrplace.scheduler.choco.ChocoScheduler in project scheduler by btrplace.
the class CGatherTest method testDiscreteWithRunningVMs.
@Test
public void testDiscreteWithRunningVMs() throws SchedulerException {
Model mo = new DefaultModel();
VM vm1 = mo.newVM();
VM vm2 = mo.newVM();
Node n1 = mo.newNode();
Node n2 = mo.newNode();
Mapping map = mo.getMapping().ready(vm1).on(n1, n2).run(n2, vm2);
Gather g = new Gather(map.getAllVMs());
g.setContinuous(false);
ChocoScheduler cra = new DefaultChocoScheduler();
List<SatConstraint> cstrs = new ArrayList<>();
cstrs.add(g);
cstrs.addAll(Running.newRunning(map.getAllVMs()));
ReconfigurationPlan plan = cra.solve(mo, cstrs);
Assert.assertNotNull(plan);
Model res = plan.getResult();
Assert.assertEquals(res.getMapping().getVMLocation(vm1), res.getMapping().getVMLocation(vm2));
}
use of org.btrplace.scheduler.choco.ChocoScheduler in project scheduler by btrplace.
the class CGatherTest method testContinuousWithNoRunningVMs.
@Test
public void testContinuousWithNoRunningVMs() throws SchedulerException {
Model mo = new DefaultModel();
VM vm1 = mo.newVM();
VM vm2 = mo.newVM();
Node n1 = mo.newNode();
Node n2 = mo.newNode();
Mapping map = mo.getMapping().on(n1, n2).ready(vm1, vm2);
Gather g = new Gather(map.getAllVMs());
g.setContinuous(true);
List<SatConstraint> cstrs = new ArrayList<>();
cstrs.add(g);
cstrs.addAll(Running.newRunning(map.getAllVMs()));
ChocoScheduler cra = new DefaultChocoScheduler();
ReconfigurationPlan plan = cra.solve(mo, cstrs);
Assert.assertNotNull(plan);
}
use of org.btrplace.scheduler.choco.ChocoScheduler in project scheduler by btrplace.
the class CGatherTest method testDiscreteWithoutRunningVM.
@Test
public void testDiscreteWithoutRunningVM() throws SchedulerException {
Model mo = new DefaultModel();
VM vm1 = mo.newVM();
VM vm2 = mo.newVM();
Node n1 = mo.newNode();
Node n2 = mo.newNode();
Mapping map = mo.getMapping().ready(vm1).on(n1, n2).run(n2, vm2);
Gather g = new Gather(map.getAllVMs());
g.setContinuous(false);
ChocoScheduler cra = new DefaultChocoScheduler();
ReconfigurationPlan plan = cra.solve(mo, Collections.singleton(g));
Assert.assertNotNull(plan);
Assert.assertEquals(plan.getSize(), 0);
Model res = plan.getResult();
Assert.assertTrue(res.getMapping().isReady(vm1));
}
use of org.btrplace.scheduler.choco.ChocoScheduler in project scheduler by btrplace.
the class CLonelyTest method testFeasibleDiscrete.
@Test
public void testFeasibleDiscrete() throws SchedulerException {
Model mo = new DefaultModel();
VM vm1 = mo.newVM();
VM vm2 = mo.newVM();
VM vm3 = mo.newVM();
VM vm4 = mo.newVM();
VM vm5 = mo.newVM();
Node n1 = mo.newNode();
Node n2 = mo.newNode();
Node n3 = mo.newNode();
mo.getMapping().on(n1, n2, n3).run(n1, vm1, vm2).run(n2, vm3, vm4, vm5);
Set<VM> mine = new HashSet<>(Arrays.asList(vm1, vm2, vm3));
ChocoScheduler cra = new DefaultChocoScheduler();
Lonely l = new Lonely(mine);
l.setContinuous(false);
ReconfigurationPlan plan = cra.solve(mo, Collections.singleton(l));
Assert.assertNotNull(plan);
// System.out.println(plan);
// Assert.assertEquals(l.isSatisfied(plan.getResult()), SatConstraint.Sat.SATISFIED);
}
Aggregations