Search in sources :

Example 41 with Mapping

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

the class GatherChecker method endsWith.

@Override
public boolean endsWith(Model mo) {
    Node used = null;
    Mapping map = mo.getMapping();
    for (VM vm : getVMs()) {
        if (map.isRunning(vm)) {
            if (used == null) {
                used = map.getVMLocation(vm);
            } else if (used != map.getVMLocation(vm)) {
                return false;
            }
        }
    }
    return true;
}
Also used : Node(org.btrplace.model.Node) VM(org.btrplace.model.VM) Mapping(org.btrplace.model.Mapping)

Example 42 with Mapping

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

the class LonelyChecker method discreteCheck.

private boolean discreteCheck(Model mo) {
    Mapping map = mo.getMapping();
    for (VM vm : getVMs()) {
        if (map.isRunning(vm)) {
            Node host = map.getVMLocation(vm);
            Set<VM> on = map.getRunningVMs(host);
            // it's a violation
            for (VM vm2 : on) {
                if (!vm2.equals(vm) && !getVMs().contains(vm2)) {
                    return false;
                }
            }
        }
    }
    return true;
}
Also used : VM(org.btrplace.model.VM) Node(org.btrplace.model.Node) BootNode(org.btrplace.plan.event.BootNode) Mapping(org.btrplace.model.Mapping)

Example 43 with Mapping

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

the class MaxOnlineChecker method endsWith.

@Override
public boolean endsWith(Model mo) {
    Mapping map = mo.getMapping();
    int on = 0;
    for (Node n : getConstraint().getInvolvedNodes()) {
        if (map.isOnline(n)) {
            on++;
        }
    }
    return on <= getConstraint().getAmount();
}
Also used : Node(org.btrplace.model.Node) ShutdownNode(org.btrplace.plan.event.ShutdownNode) BootNode(org.btrplace.plan.event.BootNode) Mapping(org.btrplace.model.Mapping)

Example 44 with Mapping

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

the class OverbookChecker method endsWith.

@Override
public boolean endsWith(Model i) {
    Mapping cfg = i.getMapping();
    ShareableResource rc = ShareableResource.get(i, id);
    if (rc == null) {
        return false;
    }
    for (Node nId : getNodes()) {
        if (cfg.isOnline(nId)) {
            // Server capacity with the ratio
            double c = rc.getCapacity(nId) * ratio;
            // Minus the VMs usage
            for (VM vmId : cfg.getRunningVMs(nId)) {
                c -= rc.getConsumption(vmId);
                if (c < 0) {
                    return false;
                }
            }
        }
    }
    return true;
}
Also used : Node(org.btrplace.model.Node) VM(org.btrplace.model.VM) Mapping(org.btrplace.model.Mapping) ShareableResource(org.btrplace.model.view.ShareableResource)

Example 45 with Mapping

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

the class RunningCapacityChecker method startsWith.

@Override
public boolean startsWith(Model mo) {
    if (getConstraint().isContinuous()) {
        int nb = 0;
        Mapping map = mo.getMapping();
        for (Node n : getNodes()) {
            nb += map.getRunningVMs(n).size();
            if (nb > qty) {
                return false;
            }
        }
        srcRunning = new HashSet<>();
        for (Node n : map.getOnlineNodes()) {
            srcRunning.addAll(map.getRunningVMs(n));
        }
        track(srcRunning);
    }
    return true;
}
Also used : Node(org.btrplace.model.Node) Mapping(org.btrplace.model.Mapping)

Aggregations

Mapping (org.btrplace.model.Mapping)83 Node (org.btrplace.model.Node)68 VM (org.btrplace.model.VM)62 Model (org.btrplace.model.Model)42 DefaultModel (org.btrplace.model.DefaultModel)39 Test (org.testng.annotations.Test)39 HashSet (java.util.HashSet)29 ReconfigurationPlan (org.btrplace.plan.ReconfigurationPlan)23 ShareableResource (org.btrplace.model.view.ShareableResource)16 RelocatableVM (org.btrplace.scheduler.choco.transition.RelocatableVM)16 BootableNode (org.btrplace.scheduler.choco.transition.BootableNode)15 ShutdownableNode (org.btrplace.scheduler.choco.transition.ShutdownableNode)15 VMTransition (org.btrplace.scheduler.choco.transition.VMTransition)15 IntVar (org.chocosolver.solver.variables.IntVar)15 SatConstraint (org.btrplace.model.constraint.SatConstraint)14 BootVM (org.btrplace.scheduler.choco.transition.BootVM)14 ForgeVM (org.btrplace.scheduler.choco.transition.ForgeVM)14 KillVM (org.btrplace.scheduler.choco.transition.KillVM)14 ResumeVM (org.btrplace.scheduler.choco.transition.ResumeVM)14 ShutdownVM (org.btrplace.scheduler.choco.transition.ShutdownVM)14