Search in sources :

Example 96 with Node

use of org.btrplace.model.Node 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)

Example 97 with Node

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

the class ShareableResource method toString.

@Override
public String toString() {
    StringJoiner joiner = new StringJoiner(",", String.format("rc:%s:", rcId), "");
    for (Node n : nodesCapacity.keySet()) {
        int c = nodesCapacity.get(n);
        joiner.add(String.format("<node %s,%d>", n, c));
    }
    StringJoiner vmJoiner = new StringJoiner(",");
    for (VM vm : vmsConsumption.keySet()) {
        int c = vmsConsumption.get(vm);
        vmJoiner.add(String.format("<VM %s,%d>", vm, c));
    }
    return String.format("%s%s", joiner, vmJoiner);
}
Also used : Node(org.btrplace.model.Node) VM(org.btrplace.model.VM) StringJoiner(java.util.StringJoiner) SideConstraint(org.btrplace.model.constraint.SideConstraint)

Example 98 with Node

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

the class Network method drawNodes.

private void drawNodes(BufferedWriter dot, NamingService<Node> nsNodes) throws IOException {
    for (Node n : getConnectedNodes()) {
        dot.append("node").append(String.valueOf(n.id())).append(" [shape=box, color=green, label=\"");
        if (nsNodes == null) {
            dot.append("Node ").append(String.valueOf(n.id()));
        } else {
            dot.append(nsNodes.resolve(n));
        }
        dot.append("\"];\n");
    }
}
Also used : Node(org.btrplace.model.Node)

Example 99 with Node

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

the class CSpread method getMisPlacedVMs.

@Override
public Set<VM> getMisPlacedVMs(Instance i) {
    Map<Node, Set<VM>> spots = new HashMap<>();
    Set<VM> bad = new HashSet<>();
    Mapping map = i.getModel().getMapping();
    for (VM vm : cstr.getInvolvedVMs()) {
        Node h = map.getVMLocation(vm);
        if (map.isRunning(vm)) {
            if (!spots.containsKey(h)) {
                spots.put(h, new HashSet<>());
            }
            spots.get(h).add(vm);
        }
    }
    for (Map.Entry<Node, Set<VM>> e : spots.entrySet()) {
        if (e.getValue().size() > 1) {
            bad.addAll(e.getValue());
        }
    }
    return bad;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) Node(org.btrplace.model.Node) VM(org.btrplace.model.VM) Mapping(org.btrplace.model.Mapping) HashMap(java.util.HashMap) Map(java.util.Map) HashSet(java.util.HashSet)

Example 100 with Node

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

the class MovementGraph method addOutgoing.

private void addOutgoing(Slice cSlice) {
    Node h = rp.getNode(cSlice.getHoster().getLB());
    List<IntVar> l = outgoings.get(h);
    if (l == null) {
        l = new ArrayList<>();
        outgoings.put(h, l);
    }
    l.add(cSlice.getStart());
}
Also used : Node(org.btrplace.model.Node) IntVar(org.chocosolver.solver.variables.IntVar)

Aggregations

Node (org.btrplace.model.Node)188 VM (org.btrplace.model.VM)110 Model (org.btrplace.model.Model)92 DefaultModel (org.btrplace.model.DefaultModel)91 Test (org.testng.annotations.Test)85 Mapping (org.btrplace.model.Mapping)68 HashSet (java.util.HashSet)48 ReconfigurationPlan (org.btrplace.plan.ReconfigurationPlan)43 SatConstraint (org.btrplace.model.constraint.SatConstraint)35 ArrayList (java.util.ArrayList)34 IntVar (org.chocosolver.solver.variables.IntVar)29 ShareableResource (org.btrplace.model.view.ShareableResource)28 VMTransition (org.btrplace.scheduler.choco.transition.VMTransition)23 MigrateVM (org.btrplace.plan.event.MigrateVM)22 BootableNode (org.btrplace.scheduler.choco.transition.BootableNode)19 RelocatableVM (org.btrplace.scheduler.choco.transition.RelocatableVM)19 ShutdownableNode (org.btrplace.scheduler.choco.transition.ShutdownableNode)19 DefaultChocoScheduler (org.btrplace.scheduler.choco.DefaultChocoScheduler)18 ChocoScheduler (org.btrplace.scheduler.choco.ChocoScheduler)16 BootVM (org.btrplace.scheduler.choco.transition.BootVM)16