diff options
author | valerijf <valerijf@yahoo-inc.com> | 2017-04-18 11:31:03 +0200 |
---|---|---|
committer | valerijf <valerijf@yahoo-inc.com> | 2017-04-18 11:31:03 +0200 |
commit | bcba809ed6caa5849d9c112501c36b94b47b92a7 (patch) | |
tree | a4233da1bf5f3f7fdc58a9118dc70bdefc3eb11c /node-admin | |
parent | 4da516e6afbac36f1c80d5e28a491748751ffff0 (diff) |
Revert "Treat NOT FOUND from Orchestrator as OK"
This reverts commit 12bd670a38e408c3ae69ec50295e56bb167f625c.
Diffstat (limited to 'node-admin')
4 files changed, 15 insertions, 14 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/Orchestrator.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/Orchestrator.java index 708ec086a67..e16f4d9bf6a 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/Orchestrator.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/Orchestrator.java @@ -12,12 +12,14 @@ public interface Orchestrator { /** * Invokes orchestrator suspend of a host. * @throws OrchestratorException if suspend was denied. + * @throws OrchestratorNotFoundException if host is unknown to the orchestrator */ void suspend(String hostName); /** * Invokes orchestrator resume of a host. * @throws OrchestratorException if resume was denied + * @throws OrchestratorNotFoundException if host is unknown to the orchestrator */ void resume(String hostName); diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImpl.java index e6bcdd84e32..9fd0b600ca6 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImpl.java @@ -3,10 +3,8 @@ package com.yahoo.vespa.hosted.node.admin.orchestrator; import com.yahoo.vespa.defaults.Defaults; -import com.yahoo.vespa.hosted.dockerapi.ContainerName; import com.yahoo.vespa.hosted.node.admin.util.ConfigServerHttpRequestExecutor; -import com.yahoo.vespa.hosted.node.admin.util.PrefixLogger; import com.yahoo.vespa.orchestrator.restapi.HostApi; import com.yahoo.vespa.orchestrator.restapi.HostSuspensionApi; import com.yahoo.vespa.orchestrator.restapi.wire.BatchHostSuspendRequest; @@ -44,9 +42,7 @@ public class OrchestratorImpl implements Orchestrator { Optional.empty(), /* body */ UpdateHostResponse.class); } catch (ConfigServerHttpRequestExecutor.NotFoundException n) { - // Orchestrator doesn't care about this node, so don't let that stop us. - getLogger(hostName).info("Got not found on suspending, allowed to suspend"); - return; + throw new OrchestratorNotFoundException("Failed to suspend " + hostName + ", host not found"); } catch (Exception e) { throw new RuntimeException("Got error on suspend", e); } @@ -81,9 +77,7 @@ public class OrchestratorImpl implements Orchestrator { String path = getSuspendPath(hostName); response = requestExecutor.delete(path, WEB_SERVICE_PORT, UpdateHostResponse.class); } catch (ConfigServerHttpRequestExecutor.NotFoundException n) { - // Orchestrator doesn't care about this node, so don't let that stop us. - getLogger(hostName).info("Got not found on resuming, allowed to resume"); - return; + throw new OrchestratorNotFoundException("Failed to resume " + hostName + ", host not found"); } catch (Exception e) { throw new RuntimeException("Got error on resume", e); } @@ -93,10 +87,6 @@ public class OrchestratorImpl implements Orchestrator { }); } - private PrefixLogger getLogger(String hostName) { - return PrefixLogger.getNodeAgentLogger(OrchestratorImpl.class, ContainerName.fromHostname(hostName)); - } - private String getSuspendPath(String hostName) { return ORCHESTRATOR_PATH_PREFIX_HOST_API + "/" + hostName + "/suspended"; } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorNotFoundException.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorNotFoundException.java new file mode 100644 index 00000000000..c20fed566dc --- /dev/null +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorNotFoundException.java @@ -0,0 +1,9 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.node.admin.orchestrator; + +@SuppressWarnings("serial") +public class OrchestratorNotFoundException extends OrchestratorException { + public OrchestratorNotFoundException(String message) { + super(message); + } +} diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImplTest.java index d9d8b127c02..c618b5c4648 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImplTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImplTest.java @@ -53,7 +53,7 @@ public class OrchestratorImplTest { orchestrator.suspend(hostName); } - @Test + @Test(expected=OrchestratorNotFoundException.class) public void testSuspendCallWithNotFound() { when(requestExecutor.put( any(String.class), @@ -100,7 +100,7 @@ public class OrchestratorImplTest { orchestrator.resume(hostName); } - @Test + @Test(expected=OrchestratorNotFoundException.class) public void testResumeCallWithNotFound() { when(requestExecutor.delete( any(String.class), |