diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2022-03-10 19:19:19 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2022-03-10 19:19:19 +0100 |
commit | c07cdf3709e0d8ed6e5266247c25010ba04468f8 (patch) | |
tree | e1d53734d0cf5d0a41fcb7894512aacd16a94e63 /node-admin | |
parent | 9ecddda1e37238420a0b1fe65ba701fdf79283cb (diff) |
Non-functional changes
Diffstat (limited to 'node-admin')
5 files changed, 8 insertions, 24 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextManager.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextManager.java index ef294d8bd2e..b76c48c3839 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextManager.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextManager.java @@ -7,7 +7,7 @@ import java.time.Instant; import java.util.Objects; /** - * This class should be used by exactly 2 thread, 1 for each interface it implements. + * This class should be used by exactly 2 threads, 1 for each interface it implements. * * @author freva */ diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java index 9b988e9a379..ada36af89e1 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java @@ -142,8 +142,7 @@ public class NodeAgentImpl implements NodeAgent { loopThread = new Thread(() -> { while (!terminated.get()) { try { - NodeAgentContext context = contextSupplier.nextContext(); - converge(context); + converge(contextSupplier.nextContext()); } catch (InterruptedException ignored) { } } }); @@ -271,7 +270,7 @@ public class NodeAgentImpl implements NodeAgent { } String output = containerOperations.restartVespa(context); - if (!output.isBlank()) { + if ( ! output.isBlank()) { context.log(logger, "Restart services output: " + output); } currentRestartGeneration = context.node().wantedRestartGeneration(); @@ -282,7 +281,7 @@ public class NodeAgentImpl implements NodeAgent { return existingContainer; } - private Optional<String> shouldRestartServices( NodeAgentContext context, Container existingContainer) { + private Optional<String> shouldRestartServices(NodeAgentContext context, Container existingContainer) { NodeSpec node = context.node(); if (!existingContainer.state().isRunning() || node.state() != NodeState.active) return Optional.empty(); @@ -578,18 +577,6 @@ public class NodeAgentImpl implements NodeAgent { return temp; } - // TODO: Also skip orchestration if we're downgrading in test/staging - // How to implement: - // - test/staging: We need to figure out whether we're in test/staging, zone is available in Environment - // - downgrading: Impossible to know unless we look at the hosted version, which is - // not available in the docker image (nor its name). Not sure how to solve this. Should - // the node repo return the hosted version or a downgrade bit in addition to - // wanted docker image etc? - // Should the tenant pipeline instead use BCP tool to upgrade faster!? - // - // More generally, the node repo response should contain sufficient info on what the docker image is, - // to allow the node admin to make decisions that depend on the docker image. Or, each docker image - // needs to contain routines for drain and suspend. For many images, these can just be dummy routines. private void orchestratorSuspendNode(NodeAgentContext context) { if (context.node().state() != NodeState.active) return; diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integration/MultiContainerTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integration/MultiContainerTest.java index de769d6a2d0..5bb279323e9 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integration/MultiContainerTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integration/MultiContainerTest.java @@ -25,8 +25,7 @@ public class MultiContainerTest { DockerImage image2 = DockerImage.fromString("registry.example.com/image2"); try (ContainerTester tester = new ContainerTester(List.of(image1, image2))) { addAndWaitForNode(tester, "host1.test.yahoo.com", image1); - NodeSpec nodeSpec2 = addAndWaitForNode( - tester, "host2.test.yahoo.com", image2); + NodeSpec nodeSpec2 = addAndWaitForNode(tester, "host2.test.yahoo.com", image2); tester.addChildNodeRepositoryNode(NodeSpec.Builder.testSpec(nodeSpec2.hostname(), NodeState.dirty).build()); diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integration/RebootTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integration/RebootTest.java index aec9336c13c..4d95991dd29 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integration/RebootTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integration/RebootTest.java @@ -33,9 +33,7 @@ public class RebootTest { ContainerName host1 = new ContainerName("host1"); tester.inOrder(tester.containerOperations).createContainer(containerMatcher(host1), any(), any()); - try { - tester.setWantedState(NodeAdminStateUpdater.State.SUSPENDED); - } catch (RuntimeException ignored) { } + tester.setWantedState(NodeAdminStateUpdater.State.SUSPENDED); tester.inOrder(tester.orchestrator).suspend( eq(HOST_HOSTNAME.value()), eq(List.of(hostname, HOST_HOSTNAME.value()))); diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java index d87a60e4a44..28ef19d4065 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java @@ -784,8 +784,8 @@ public class NodeAgentImplTest { return new NodeAgentImpl(contextSupplier, nodeRepository, orchestrator, containerOperations, () -> RegistryCredentials.none, storageMaintainer, flagSource, - List.of(credentialsMaintainer), Optional.of(aclMaintainer), - Optional.of(healthChecker), clock, warmUpDuration, VespaServiceDumper.DUMMY_INSTANCE); + List.of(credentialsMaintainer), Optional.of(aclMaintainer), Optional.of(healthChecker), + clock, warmUpDuration, VespaServiceDumper.DUMMY_INSTANCE); } private void mockGetContainer(DockerImage dockerImage, boolean isRunning) { |