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;
}
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);
}
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");
}
}
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;
}
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());
}
Aggregations