diff options
author | Valerij <valerij92@gmail.com> | 2017-04-13 14:55:02 +0200 |
---|---|---|
committer | Valerij <valerij92@gmail.com> | 2017-04-13 14:55:02 +0200 |
commit | 12bd670a38e408c3ae69ec50295e56bb167f625c (patch) | |
tree | 286de022f5eec3f862be695fa38d1ad2868a4e17 /node-admin/src | |
parent | efff6006aafc97e3abcd7a4184c66d983314ba53 (diff) |
Treat NOT FOUND from Orchestrator as OK
Diffstat (limited to 'node-admin/src')
4 files changed, 14 insertions, 15 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 e16f4d9bf6a..708ec086a67 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,14 +12,12 @@ 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 9fd0b600ca6..e6bcdd84e32 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,8 +3,10 @@ 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; @@ -42,7 +44,9 @@ public class OrchestratorImpl implements Orchestrator { Optional.empty(), /* body */ UpdateHostResponse.class); } catch (ConfigServerHttpRequestExecutor.NotFoundException n) { - throw new OrchestratorNotFoundException("Failed to suspend " + hostName + ", host not found"); + // 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; } catch (Exception e) { throw new RuntimeException("Got error on suspend", e); } @@ -77,7 +81,9 @@ public class OrchestratorImpl implements Orchestrator { String path = getSuspendPath(hostName); response = requestExecutor.delete(path, WEB_SERVICE_PORT, UpdateHostResponse.class); } catch (ConfigServerHttpRequestExecutor.NotFoundException n) { - throw new OrchestratorNotFoundException("Failed to resume " + hostName + ", host not found"); + // 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; } catch (Exception e) { throw new RuntimeException("Got error on resume", e); } @@ -87,6 +93,10 @@ 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 deleted file mode 100644 index c20fed566dc..00000000000 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorNotFoundException.java +++ /dev/null @@ -1,9 +0,0 @@ -// 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 c618b5c4648..d9d8b127c02 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(expected=OrchestratorNotFoundException.class) + @Test public void testSuspendCallWithNotFound() { when(requestExecutor.put( any(String.class), @@ -100,7 +100,7 @@ public class OrchestratorImplTest { orchestrator.resume(hostName); } - @Test(expected=OrchestratorNotFoundException.class) + @Test public void testResumeCallWithNotFound() { when(requestExecutor.delete( any(String.class), |