use of org.btrplace.scheduler.choco.transition.StayAwayVM in project scheduler by btrplace.
the class CSequentialVMTransitions method inject.
@Override
public boolean inject(Parameters ps, ReconfigurationProblem rp) throws SchedulerException {
List<VM> seq = cstr.getInvolvedVMs();
List<VMTransition> ams = new ArrayList<>();
for (VM vmId : seq) {
VMTransition am = rp.getVMAction(vmId);
// Avoid VMs with no action model or Transition that do not denotes a state transition
if (am == null || am instanceof StayAwayVM || am instanceof RelocatableVM) {
continue;
}
ams.add(am);
}
if (ams.size() > 1) {
Iterator<VMTransition> ite = ams.iterator();
VMTransition prev = ite.next();
Model csp = rp.getModel();
while (ite.hasNext()) {
VMTransition cur = ite.next();
csp.post(csp.arithm(prev.getEnd(), "<=", cur.getStart()));
prev = cur;
}
}
return true;
}
Aggregations