diff options
author | Jon Bratseth <bratseth@gmail.com> | 2020-06-10 14:04:29 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2020-06-10 14:04:29 +0200 |
commit | 9fc05281d6a79c26efe04edeb7604300f0c05845 (patch) | |
tree | d2c8e6abc6bfe02d564815aa6c83715eb880e432 /node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SpareCapacityMaintainer.java | |
parent | 49ad958565e4db19872bfb1a069a0209a652c011 (diff) |
Refactor - no funcntional changes
Diffstat (limited to 'node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SpareCapacityMaintainer.java')
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SpareCapacityMaintainer.java | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SpareCapacityMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SpareCapacityMaintainer.java index 4f7902d4dbc..c0e39b39e94 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SpareCapacityMaintainer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SpareCapacityMaintainer.java @@ -63,19 +63,44 @@ public class SpareCapacityMaintainer extends NodeRepositoryMaintainer { int worstCaseHostLoss = failurePath.get().hostsCausingFailure.size(); metric.set("spareHostCapacity", worstCaseHostLoss - 1, null); if (worstCaseHostLoss == 1) { // Try to get back to needing 2 hosts to fail in the worst case - Optional<Node> moveCandidate = identifyMoveCandidate(failurePath.get()); + Optional<Move> moveCandidate = identifyMoveCandidate(failurePath.get()); if (moveCandidate.isPresent()) move(moveCandidate.get()); } } } - private Optional<Node> identifyMoveCandidate(CapacityChecker.HostFailurePath failurePath) { - Node host = failurePath.hostsCausingFailure.get(0); + private Optional<Move> identifyMoveCandidate(CapacityChecker.HostFailurePath failurePath) { + Optional<Node> nodeWhichCantMove = failurePath.failureReason.tenant; + if (nodeWhichCantMove.isEmpty()) return Optional.empty(); + return findMoveWhichMakesRoomFor(nodeWhichCantMove.get()); + } + private Optional<Move> findMoveWhichMakesRoomFor(Node node) { + return Optional.empty(); } - private void move(Node node) { + private void move(Move move) { + + } + + private static class Move { + + static final Move none = new Move(null, null); + + final Node node; + final Node toHost; + + Move(Node node, Node toHost) { + this.node = node; + this.toHost = toHost; + } + + @Override + public String toString() { + return "move " + + ( node == null ? "none" : (node.hostname() + " to " + toHost)); + } } |