aboutsummaryrefslogtreecommitdiffstats
path: root/node-repository/src
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2022-10-06 13:03:47 +0200
committerHarald Musum <musum@yahooinc.com>2022-10-06 13:03:47 +0200
commit319206b87b689dfe19007500cc6dac6e84f02103 (patch)
tree6665a3d0544f85159eff536b0ba6fa56d600df37 /node-repository/src
parentbbb47ccadb603a84b3a9d4e695aa098ea46a25ad (diff)
Change exception when unable to find all requested hosts
Throwing an IllegalArgumentException in this case will lead to an invalid application package error returned from config server, which is misleading,as there is nothing the customer can do with the application to fix this, it is a transient issue in node repo or a bug in vespa code. Throwing a RuntimeException will lead to an internal server error being returned, which is more appropriate.
Diffstat (limited to 'node-repository/src')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java7
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTest.java2
2 files changed, 3 insertions, 6 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java
index 5d73c4929af..555ec741b52 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java
@@ -77,13 +77,10 @@ class Activator {
NodeList continuedActive = oldActive.matching(node -> hostnames.contains(node.hostname()));
NodeList newActive = withHostInfo(continuedActive, hosts, activationTime).and(reserved); // All nodes that will be active when this is committed
if ( ! containsAll(hostnames, newActive))
- throw new IllegalArgumentException("Activation of " + application + " failed. " +
- "Could not find all requested hosts." +
+ throw new RuntimeException("Activation of " + application + " failed, could not find all requested hosts." +
"\nRequested: " + hosts +
"\nReserved: " + reserved.hostnames() +
- "\nActive: " + oldActive.hostnames() +
- "\nThis might happen if the time from reserving host to activation takes " +
- "longer time than reservation expiry (the hosts will then no longer be reserved)");
+ "\nActive: " + oldActive.hostnames());
validateParentHosts(application, allNodes, reserved);
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTest.java
index 8c9c8939616..c1c4b1e96ea 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTest.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTest.java
@@ -651,7 +651,7 @@ public class ProvisioningTest {
tester.activate(application, state.allHosts);
fail("Expected exception");
}
- catch (IllegalArgumentException e) {
+ catch (RuntimeException e) {
assertTrue(e.getMessage().startsWith("Activation of " + application + " failed"));
}
}