summaryrefslogtreecommitdiffstats
path: root/node-repository
diff options
context:
space:
mode:
authorValerij Fredriksen <valerijf@oath.com>2018-02-08 14:24:10 +0100
committerValerij Fredriksen <valerijf@oath.com>2018-02-08 14:24:10 +0100
commit9f529e083f5a0028ce49a626ba83ffd87e073d11 (patch)
treeec79635e0e7962040c5fa4e77d8f6ba3c905822a /node-repository
parent179c617d0abfd047bab78d35ded61ca35c550b39 (diff)
Allow retiring of host if all children are parked
Diffstat (limited to 'node-repository')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/RetiredExpirer.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/RetiredExpirer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/RetiredExpirer.java
index 6d82dfb7b4e..5a505710495 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/RetiredExpirer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/RetiredExpirer.java
@@ -86,14 +86,16 @@ public class RetiredExpirer extends Maintainer {
/**
* Checks if the node can be removed:
- * if the node is {@link NodeType#host}, it will only be removed if it has no children
+ * if the node is {@link NodeType#host}, it will only be removed if it has no children, or all its children are parked
* Otherwise, a removal is allowed if either of these are true:
* - The node has been in state {@link History.Event.Type#retired} for longer than {@link #retiredExpiry}
* - Orchestrator allows it
*/
private boolean canRemove(Node node) {
if (node.type() == NodeType.host) {
- return nodeRepository().getChildNodes(node.hostname()).isEmpty();
+ return nodeRepository()
+ .getChildNodes(node.hostname()).stream()
+ .allMatch(child -> child.state() == Node.State.parked);
}
Optional<Instant> timeOfRetiredEvent = node.history().event(History.Event.Type.retired).map(History.Event::at);