use of org.btrplace.model.Mapping in project scheduler by btrplace.
the class CFence method getMisPlacedVMs.
@Override
public Set<VM> getMisPlacedVMs(Instance i) {
Mapping map = i.getModel().getMapping();
VM vm = cstr.getInvolvedVMs().iterator().next();
if (map.isRunning(vm) && !cstr.getInvolvedNodes().contains(map.getVMLocation(vm))) {
return Collections.singleton(vm);
}
return Collections.emptySet();
}
use of org.btrplace.model.Mapping in project scheduler by btrplace.
the class CKilled method getMisPlacedVMs.
@Override
public Set<VM> getMisPlacedVMs(Instance i) {
Mapping map = i.getModel().getMapping();
VM v = cstr.getInvolvedVMs().iterator().next();
if (map.contains(v)) {
return Collections.singleton(v);
}
return Collections.emptySet();
}
use of org.btrplace.model.Mapping in project scheduler by btrplace.
the class CQuarantine method inject.
@Override
public boolean inject(Parameters ps, ReconfigurationProblem rp) throws SchedulerException {
// It is just a composition of a root constraint on the VMs on the given nodes (the zone)
// plus a ban on the other VMs to prevent them for being hosted in the zone
Mapping map = rp.getSourceModel().getMapping();
Node n = cstr.getInvolvedNodes().iterator().next();
int nIdx = rp.getNode(n);
for (VM vm : rp.getFutureRunningVMs()) {
if (n.equals(map.getVMLocation(vm))) {
IntVar d = rp.getVMAction(vm).getDSlice().getHoster();
try {
d.instantiateTo(nIdx, Cause.Null);
} catch (ContradictionException e) {
rp.getLogger().error("Unable to root " + vm + " on " + n, e);
return false;
}
} else {
IntVar d = rp.getVMAction(vm).getDSlice().getHoster();
try {
d.removeValue(nIdx, Cause.Null);
} catch (ContradictionException e) {
rp.getLogger().error("Unable to disallow " + vm + " to be hosted on " + n, e);
return false;
}
}
}
return true;
}
use of org.btrplace.model.Mapping in project scheduler by btrplace.
the class CReady method getMisPlacedVMs.
@Override
public Set<VM> getMisPlacedVMs(Instance i) {
VM v = cstr.getInvolvedVMs().iterator().next();
Mapping map = i.getModel().getMapping();
if (!map.isReady(v)) {
return Collections.singleton(v);
}
return Collections.emptySet();
}
use of org.btrplace.model.Mapping in project scheduler by btrplace.
the class CRunning method getMisPlacedVMs.
@Override
public Set<VM> getMisPlacedVMs(Instance i) {
VM vm = cstr.getInvolvedVMs().iterator().next();
Mapping map = i.getModel().getMapping();
if (!map.isRunning(vm)) {
return Collections.singleton(vm);
}
return Collections.emptySet();
}
Aggregations