diff options
author | Martin Polden <mpolden@mpolden.no> | 2021-02-26 12:57:55 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2021-02-26 12:59:40 +0100 |
commit | 487328e1b15e289a3a7c30cbf66fff31871b88ef (patch) | |
tree | d8480a7618527bf050a14bacd1b0db22f8b94255 /node-repository | |
parent | c3a56d4d8f1834357978197f1946f61c8358b35c (diff) |
Consider reservedTo before switch priority
Diffstat (limited to 'node-repository')
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeCandidate.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeCandidate.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeCandidate.java index 143ae8f99ad..85e73245508 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeCandidate.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeCandidate.java @@ -133,10 +133,6 @@ public abstract class NodeCandidate implements Nodelike, Comparable<NodeCandidat if (!this.isSurplus && other.isSurplus) return -1; if (!other.isSurplus && this.isSurplus) return 1; - // Prefer node on exclusive switch - int switchPriority = switchPriority(other); - if (switchPriority != 0) return switchPriority; - // Choose reserved nodes from a previous allocation attempt (which exist in node repo) if (this.isInNodeRepoAndReserved() && ! other.isInNodeRepoAndReserved()) return -1; if (other.isInNodeRepoAndReserved() && ! this.isInNodeRepoAndReserved()) return 1; @@ -157,6 +153,11 @@ public abstract class NodeCandidate implements Nodelike, Comparable<NodeCandidat if ( this.parent.get().reservedTo().isPresent() && ! other.parent.get().reservedTo().isPresent()) return -1; if ( ! this.parent.get().reservedTo().isPresent() && other.parent.get().reservedTo().isPresent()) return 1; + // Prefer node on exclusive switch + int switchPriority = switchPriority(other); + if (switchPriority != 0) return switchPriority; + + // Prefer node with cheapest storage int diskCostDifference = NodeResources.DiskSpeed.compare(this.parent.get().flavor().resources().diskSpeed(), other.parent.get().flavor().resources().diskSpeed()); if (diskCostDifference != 0) @@ -173,14 +174,15 @@ public abstract class NodeCandidate implements Nodelike, Comparable<NodeCandidat if ( ! lessThanHalfTheHost(this) && lessThanHalfTheHost(other)) return 1; } + // Prefer host with least skew int hostPriority = hostPriority(other); if (hostPriority != 0) return hostPriority; - // Choose cheapest node + // Prefer node with cheapest flavor if (this.flavor().cost() < other.flavor().cost()) return -1; if (other.flavor().cost() < this.flavor().cost()) return 1; - // Choose nodes where host is in more desirable state + // Prefer node where host is in more desirable state int thisHostStatePri = this.parent.map(host -> HOST_STATE_PRIORITY.indexOf(host.state())).orElse(-2); int otherHostStatePri = other.parent.map(host -> HOST_STATE_PRIORITY.indexOf(host.state())).orElse(-2); if (thisHostStatePri != otherHostStatePri) return otherHostStatePri - thisHostStatePri; |