diff options
author | Håkon Hallingstad <hakon@yahoo-inc.com> | 2017-06-12 01:13:05 +0200 |
---|---|---|
committer | Håkon Hallingstad <hakon@yahoo-inc.com> | 2017-06-12 01:13:05 +0200 |
commit | 29f331a02b091d1dbd958a95c8b562165326d76a (patch) | |
tree | 37f3cff32b20137af09f131d80f5fecea2e6b945 /orchestrator-restapi | |
parent | 3d0f44f63919702713908b8da56434a5260f18df (diff) |
Orchestrator support for setting host status
Directly setting the host status can be useful for an operator, e.g. to break a
deadlock.
Unfortunately, some code use the term "host status" while others use "host
state". I haven't settled yet on which is preferred, e.g. 'state' is used in
REST APIs, but 'status' is the original term and slightly more used. This PR
maintains the local use of the terms, meaning it adds 'state' where that's
normally used and 'status' other places.
Setting the deadlock is done with a PATCH request, which is defined in
jaxrs_utils. jaxrs_utils only defines PATCH, and that's not used anywhere else
except in jaxrs_client_utils tests. So I remove this module as a dependency a
couple of places.
Diffstat (limited to 'orchestrator-restapi')
4 files changed, 44 insertions, 0 deletions
diff --git a/orchestrator-restapi/pom.xml b/orchestrator-restapi/pom.xml index b2b581a7fc6..79e8dc3e618 100644 --- a/orchestrator-restapi/pom.xml +++ b/orchestrator-restapi/pom.xml @@ -22,6 +22,12 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>com.yahoo.vespa</groupId> + <artifactId>jaxrs_utils</artifactId> + <version>${project.version}</version> + <scope>compile</scope> + </dependency> + <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>${jackson2.version}</version> diff --git a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/HostApi.java b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/HostApi.java index a71db5b2749..2ddf05777ae 100644 --- a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/HostApi.java +++ b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/HostApi.java @@ -2,8 +2,11 @@ package com.yahoo.vespa.orchestrator.restapi; import com.yahoo.vespa.orchestrator.restapi.wire.GetHostResponse; +import com.yahoo.vespa.orchestrator.restapi.wire.PatchHostRequest; +import com.yahoo.vespa.orchestrator.restapi.wire.PatchHostResponse; import com.yahoo.vespa.orchestrator.restapi.wire.UpdateHostResponse; +import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.PUT; @@ -37,6 +40,15 @@ public interface HostApi { GetHostResponse getHost(@PathParam("hostname") String hostNameString); /** + * Tweak internal Orchestrator state for host. + */ + @PUT + @Path("/{hostname}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + PatchHostResponse patch(@PathParam("hostname") String hostNameString, PatchHostRequest request); + + /** * Ask for permission to temporarily suspend all services on a host. * * On success, none, some, or all services on the host may already have been effectively suspended, diff --git a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/PatchHostRequest.java b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/PatchHostRequest.java new file mode 100644 index 00000000000..6ce029e7f9c --- /dev/null +++ b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/PatchHostRequest.java @@ -0,0 +1,13 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.orchestrator.restapi.wire; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class PatchHostRequest { + /** String representation of HostStatus enum value. */ + @JsonProperty public String state; +} diff --git a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/PatchHostResponse.java b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/PatchHostResponse.java new file mode 100644 index 00000000000..f7468fe5907 --- /dev/null +++ b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/PatchHostResponse.java @@ -0,0 +1,13 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.orchestrator.restapi.wire; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class PatchHostResponse { + /** Description of the HTTP response status code. */ + @JsonProperty public String description; +} |