Search in sources :

Example 6 with Node

use of org.btrplace.model.Node in project scheduler by btrplace.

the class RunningCapacityChecker method endsWith.

@Override
public boolean endsWith(Model mo) {
    int nb = 0;
    Mapping map = mo.getMapping();
    for (Node n : getNodes()) {
        nb += map.getRunningVMs(n).size();
        if (nb > qty) {
            return false;
        }
    }
    return true;
}
Also used : Node(org.btrplace.model.Node) Mapping(org.btrplace.model.Mapping)

Example 7 with Node

use of org.btrplace.model.Node in project scheduler by btrplace.

the class ResourceCapacityChecker method endsWith.

@Override
public boolean endsWith(Model i) {
    ShareableResource r = ShareableResource.get(i, getConstraint().getResource());
    if (r == null) {
        return false;
    }
    int remainder = getConstraint().getAmount();
    for (Node id : getNodes()) {
        if (i.getMapping().isOnline(id)) {
            remainder -= r.sumConsumptions(i.getMapping().getRunningVMs(id), true);
            if (remainder < 0) {
                return false;
            }
        }
    }
    return true;
}
Also used : Node(org.btrplace.model.Node) ShareableResource(org.btrplace.model.view.ShareableResource)

Example 8 with Node

use of org.btrplace.model.Node in project scheduler by btrplace.

the class ResourceCapacityChecker method startsWith.

@Override
public boolean startsWith(Model mo) {
    if (getConstraint().isContinuous()) {
        rc = ShareableResource.get(mo, getConstraint().getResource());
        free = getConstraint().getAmount();
        Mapping map = mo.getMapping();
        for (Node n : getNodes()) {
            free -= rc.sumConsumptions(map.getRunningVMs(n), true);
            if (free < 0) {
                return false;
            }
        }
    }
    return true;
}
Also used : Node(org.btrplace.model.Node) Mapping(org.btrplace.model.Mapping)

Example 9 with Node

use of org.btrplace.model.Node in project scheduler by btrplace.

the class SeqChecker method startsWith.

@Override
public boolean startsWith(Model mo) {
    running = new HashSet<>();
    for (Node n : mo.getMapping().getOnlineNodes()) {
        running.addAll(mo.getMapping().getRunningVMs(n));
    }
    track(running);
    return true;
}
Also used : Node(org.btrplace.model.Node)

Example 10 with Node

use of org.btrplace.model.Node in project scheduler by btrplace.

the class SpreadChecker method endsWith.

@Override
public boolean endsWith(Model mo) {
    Set<Node> forbidden = new HashSet<>();
    Mapping map = mo.getMapping();
    for (VM vm : getVMs()) {
        if (map.isRunning(vm) && !forbidden.add(map.getVMLocation(vm))) {
            return false;
        }
    }
    return true;
}
Also used : Node(org.btrplace.model.Node) VM(org.btrplace.model.VM) ShutdownVM(org.btrplace.plan.event.ShutdownVM) MigrateVM(org.btrplace.plan.event.MigrateVM) SuspendVM(org.btrplace.plan.event.SuspendVM) KillVM(org.btrplace.plan.event.KillVM) Mapping(org.btrplace.model.Mapping) HashSet(java.util.HashSet)

Aggregations

Node (org.btrplace.model.Node)382 DefaultModel (org.btrplace.model.DefaultModel)278 Model (org.btrplace.model.Model)276 VM (org.btrplace.model.VM)262 Test (org.testng.annotations.Test)259 Mapping (org.btrplace.model.Mapping)187 ReconfigurationPlan (org.btrplace.plan.ReconfigurationPlan)142 HashSet (java.util.HashSet)95 SatConstraint (org.btrplace.model.constraint.SatConstraint)87 ArrayList (java.util.ArrayList)86 DefaultChocoScheduler (org.btrplace.scheduler.choco.DefaultChocoScheduler)82 MigrateVM (org.btrplace.plan.event.MigrateVM)72 ShareableResource (org.btrplace.model.view.ShareableResource)71 ChocoScheduler (org.btrplace.scheduler.choco.ChocoScheduler)64 ShutdownNode (org.btrplace.plan.event.ShutdownNode)52 Instance (org.btrplace.model.Instance)43 BootNode (org.btrplace.plan.event.BootNode)41 DefaultParameters (org.btrplace.scheduler.choco.DefaultParameters)40 DefaultReconfigurationProblemBuilder (org.btrplace.scheduler.choco.DefaultReconfigurationProblemBuilder)36 ReconfigurationProblem (org.btrplace.scheduler.choco.ReconfigurationProblem)36