summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-02-23 11:18:08 +0100
committerJon Bratseth <bratseth@gmail.com>2022-02-23 11:18:08 +0100
commitd49afeaea9c407da990ed494266a0cc8374f48c1 (patch)
treee088490857e4565c18f7333436d9087dfc01b27b /configserver
parentf0ae94a10d7a83ddee2eaa484f34f0bd4dd01e02 (diff)
Replace 'out of capacity' by 'node allocation failure'
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpErrorResponse.java7
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpHandler.java6
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ModelsBuilder.java4
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java8
4 files changed, 12 insertions, 13 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpErrorResponse.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpErrorResponse.java
index c414d8dfa9a..9b3b3cef5b5 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpErrorResponse.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpErrorResponse.java
@@ -20,7 +20,6 @@ import static com.yahoo.jdisc.Response.Status.REQUEST_TIMEOUT;
/**
* @author Ulf Lilleengen
- * @since 5.1
*/
public class HttpErrorResponse extends HttpResponse {
@@ -45,7 +44,7 @@ public class HttpErrorResponse extends HttpResponse {
INVALID_APPLICATION_PACKAGE,
METHOD_NOT_ALLOWED,
NOT_FOUND,
- OUT_OF_CAPACITY,
+ NODE_ALLOCATION_FAILURE,
REQUEST_TIMEOUT,
UNKNOWN_VESPA_VERSION,
PARENT_HOST_NOT_READY,
@@ -66,8 +65,8 @@ public class HttpErrorResponse extends HttpResponse {
return new HttpErrorResponse(BAD_REQUEST, ErrorCode.INVALID_APPLICATION_PACKAGE.name(), msg);
}
- public static HttpErrorResponse outOfCapacity(String msg) {
- return new HttpErrorResponse(BAD_REQUEST, ErrorCode.OUT_OF_CAPACITY.name(), msg);
+ public static HttpErrorResponse nodeAllocationFailure(String msg) {
+ return new HttpErrorResponse(BAD_REQUEST, ErrorCode.NODE_ALLOCATION_FAILURE.name(), msg);
}
public static HttpErrorResponse badRequest(String msg) {
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpHandler.java
index 190005771c7..2700f401a86 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpHandler.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpHandler.java
@@ -3,7 +3,7 @@ package com.yahoo.vespa.config.server.http;
import com.yahoo.config.provision.ApplicationLockException;
import com.yahoo.config.provision.CertificateNotReadyException;
-import com.yahoo.config.provision.OutOfCapacityException;
+import com.yahoo.config.provision.NodeAllocationException;
import com.yahoo.config.provision.ParentHostUnavailableException;
import com.yahoo.config.provision.exception.ActivationConflictException;
import com.yahoo.config.provision.exception.LoadBalancerServiceException;
@@ -55,8 +55,8 @@ public class HttpHandler extends ThreadedHttpRequestHandler {
return HttpErrorResponse.invalidApplicationPackage(getMessage(e, request));
} catch (IllegalArgumentException e) {
return HttpErrorResponse.badRequest(getMessage(e, request));
- } catch (OutOfCapacityException e) {
- return HttpErrorResponse.outOfCapacity(getMessage(e, request));
+ } catch (NodeAllocationException e) {
+ return HttpErrorResponse.nodeAllocationFailure(getMessage(e, request));
} catch (InternalServerException e) {
return HttpErrorResponse.internalServerError(getMessage(e, request));
} catch (UnknownVespaVersionException e) {
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ModelsBuilder.java b/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ModelsBuilder.java
index 0fbece2681b..3f655ec66f6 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ModelsBuilder.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ModelsBuilder.java
@@ -13,7 +13,7 @@ import com.yahoo.config.provision.AllocatedHosts;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ApplicationLockException;
import com.yahoo.config.provision.DockerImage;
-import com.yahoo.config.provision.OutOfCapacityException;
+import com.yahoo.config.provision.NodeAllocationException;
import com.yahoo.config.provision.TransientException;
import com.yahoo.config.provision.Zone;
import com.yahoo.lang.SettableOptional;
@@ -123,7 +123,7 @@ public abstract class ModelsBuilder<MODELRESULT extends ModelResult> {
buildLatestModelForThisMajor, majorVersion));
buildLatestModelForThisMajor = false; // We have successfully built latest model version, do it only for this major
}
- catch (OutOfCapacityException | ApplicationLockException | TransientException e) {
+ catch (NodeAllocationException | ApplicationLockException | TransientException e) {
// Don't wrap this exception, and don't try to load other model versions as this is (most likely)
// caused by the state of the system, not the model version/application combination
throw e;
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java
index 0b8b142e3aa..9071b12507e 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java
@@ -8,7 +8,7 @@ import com.yahoo.config.provision.ApplicationLockException;
import com.yahoo.config.provision.ApplicationName;
import com.yahoo.config.provision.DockerImage;
import com.yahoo.config.provision.InstanceName;
-import com.yahoo.config.provision.OutOfCapacityException;
+import com.yahoo.config.provision.NodeAllocationException;
import com.yahoo.config.provision.TenantName;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.jdisc.http.HttpRequest;
@@ -246,15 +246,15 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
@Test
public void test_out_of_capacity_response() throws IOException {
long sessionId = applicationRepository.createSession(applicationId(), timeoutBudget, app);
- String exceptionMessage = "Out of capacity";
+ String exceptionMessage = "Node allocation failure";
FailingSessionPrepareHandler handler = new FailingSessionPrepareHandler(SessionPrepareHandler.testContext(),
applicationRepository,
configserverConfig,
- new OutOfCapacityException(exceptionMessage));
+ new NodeAllocationException(exceptionMessage));
HttpResponse response = handler.handle(createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, sessionId));
assertEquals(400, response.getStatus());
Slime data = getData(response);
- assertEquals(HttpErrorResponse.ErrorCode.OUT_OF_CAPACITY.name(), data.get().field("error-code").asString());
+ assertEquals(HttpErrorResponse.ErrorCode.NODE_ALLOCATION_FAILURE.name(), data.get().field("error-code").asString());
assertEquals(exceptionMessage, data.get().field("message").asString());
}