Search in sources :

Example 1 with NodeAdminStateUpdaterImpl

use of com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdminStateUpdaterImpl in project vespa by vespa-engine.

the class RebootTest method test.

@Test
@Ignore
public void test() throws InterruptedException, UnknownHostException {
    try (DockerTester dockerTester = new DockerTester()) {
        dockerTester.addContainerNodeSpec(createContainerNodeSpec());
        // Wait for node admin to be notified with node repo state and the docker container has been started
        while (dockerTester.nodeAdmin.getListOfHosts().size() == 0) {
            Thread.sleep(10);
        }
        // Check that the container is started and NodeRepo has received the PATCH update
        dockerTester.callOrderVerifier.assertInOrder("createContainerCommand with DockerImage { imageId=dockerImage }, HostName: host1.test.yahoo.com, ContainerName { name=host1 }", "updateNodeAttributes with HostName: host1.test.yahoo.com, NodeAttributes{restartGeneration=1, rebootGeneration=null,  dockerImage=dockerImage, vespaVersion='null'}");
        NodeAdminStateUpdaterImpl updater = dockerTester.nodeAdminStateUpdater;
        assertThat(updater.setResumeStateAndCheckIfResumed(NodeAdminStateUpdater.State.SUSPENDED), is(Optional.of("Not all node agents are frozen.")));
        updater.setResumeStateAndCheckIfResumed(NodeAdminStateUpdater.State.SUSPENDED);
        NodeAdmin nodeAdmin = dockerTester.nodeAdmin;
        // Wait for node admin to be frozen
        while (!nodeAdmin.isFrozen()) {
            System.out.println("Node admin not frozen yet");
            Thread.sleep(10);
        }
        assertTrue(nodeAdmin.setFrozen(false));
        dockerTester.callOrderVerifier.assertInOrder("executeInContainer with ContainerName { name=host1 }, args: [" + DockerTester.NODE_PROGRAM + ", stop]");
    }
}
Also used : NodeAdminStateUpdaterImpl(com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdminStateUpdaterImpl) NodeAdmin(com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdmin) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with NodeAdminStateUpdaterImpl

use of com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdminStateUpdaterImpl in project vespa by vespa-engine.

the class DockerAdminComponent method createNodeAdminStateUpdater.

private NodeAdminStateUpdaterImpl createNodeAdminStateUpdater() {
    if (!environment.isPresent()) {
        environment = Optional.of(new Environment(configServerConfig));
    }
    Clock clock = Clock.systemUTC();
    String dockerHostHostName = environment.get().getParentHostHostname();
    ProcessExecuter processExecuter = new ProcessExecuter();
    docker.start();
    DockerOperations dockerOperations = new DockerOperationsImpl(docker, environment.get(), processExecuter, new IPAddressesImpl());
    StorageMaintainer storageMaintainer = new StorageMaintainer(dockerOperations, processExecuter, metricReceiver, environment.get(), clock);
    AclMaintainer aclMaintainer = new AclMaintainer(dockerOperations, configServerClients.nodeRepository(), dockerHostHostName);
    Function<String, NodeAgent> nodeAgentFactory = (hostName) -> new NodeAgentImpl(hostName, configServerClients.nodeRepository(), configServerClients.orchestrator(), dockerOperations, storageMaintainer, aclMaintainer, environment.get(), clock, NODE_AGENT_SCAN_INTERVAL);
    NodeAdmin nodeAdmin = new NodeAdminImpl(dockerOperations, nodeAgentFactory, storageMaintainer, aclMaintainer, metricReceiver, clock);
    return new NodeAdminStateUpdaterImpl(configServerClients.nodeRepository(), configServerClients.orchestrator(), storageMaintainer, nodeAdmin, dockerHostHostName, clock, NODE_ADMIN_CONVERGE_STATE_INTERVAL, classLocking);
}
Also used : ConfigServerClients(com.yahoo.vespa.hosted.node.admin.configserver.ConfigServerClients) NodeAdminImpl(com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdminImpl) NodeAdminStateUpdaterImpl(com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdminStateUpdaterImpl) ClassLocking(com.yahoo.concurrent.classlock.ClassLocking) StorageMaintainer(com.yahoo.vespa.hosted.node.admin.maintenance.StorageMaintainer) NodeAdminStateUpdater(com.yahoo.vespa.hosted.node.admin.provider.NodeAdminStateUpdater) DockerOperationsImpl(com.yahoo.vespa.hosted.node.admin.docker.DockerOperationsImpl) DockerOperations(com.yahoo.vespa.hosted.node.admin.docker.DockerOperations) NodeAgentImpl(com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentImpl) Function(java.util.function.Function) ConfigServerConfig(com.yahoo.vespa.hosted.node.admin.config.ConfigServerConfig) ProcessExecuter(com.yahoo.system.ProcessExecuter) MetricReceiverWrapper(com.yahoo.vespa.hosted.dockerapi.metrics.MetricReceiverWrapper) NodeAdmin(com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdmin) Docker(com.yahoo.vespa.hosted.dockerapi.Docker) AclMaintainer(com.yahoo.vespa.hosted.node.admin.maintenance.acl.AclMaintainer) IPAddressesImpl(com.yahoo.vespa.hosted.node.admin.task.util.network.IPAddressesImpl) Duration(java.time.Duration) Clock(java.time.Clock) Optional(java.util.Optional) NodeAgent(com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgent) DockerOperationsImpl(com.yahoo.vespa.hosted.node.admin.docker.DockerOperationsImpl) ProcessExecuter(com.yahoo.system.ProcessExecuter) IPAddressesImpl(com.yahoo.vespa.hosted.node.admin.task.util.network.IPAddressesImpl) DockerOperations(com.yahoo.vespa.hosted.node.admin.docker.DockerOperations) StorageMaintainer(com.yahoo.vespa.hosted.node.admin.maintenance.StorageMaintainer) NodeAgentImpl(com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentImpl) NodeAgent(com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgent) NodeAdmin(com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdmin) Clock(java.time.Clock) NodeAdminImpl(com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdminImpl) NodeAdminStateUpdaterImpl(com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdminStateUpdaterImpl) AclMaintainer(com.yahoo.vespa.hosted.node.admin.maintenance.acl.AclMaintainer)

Aggregations

NodeAdmin (com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdmin)2 NodeAdminStateUpdaterImpl (com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdminStateUpdaterImpl)2 ClassLocking (com.yahoo.concurrent.classlock.ClassLocking)1 ProcessExecuter (com.yahoo.system.ProcessExecuter)1 Docker (com.yahoo.vespa.hosted.dockerapi.Docker)1 MetricReceiverWrapper (com.yahoo.vespa.hosted.dockerapi.metrics.MetricReceiverWrapper)1 ConfigServerConfig (com.yahoo.vespa.hosted.node.admin.config.ConfigServerConfig)1 ConfigServerClients (com.yahoo.vespa.hosted.node.admin.configserver.ConfigServerClients)1 DockerOperations (com.yahoo.vespa.hosted.node.admin.docker.DockerOperations)1 DockerOperationsImpl (com.yahoo.vespa.hosted.node.admin.docker.DockerOperationsImpl)1 StorageMaintainer (com.yahoo.vespa.hosted.node.admin.maintenance.StorageMaintainer)1 AclMaintainer (com.yahoo.vespa.hosted.node.admin.maintenance.acl.AclMaintainer)1 NodeAdminImpl (com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdminImpl)1 NodeAgent (com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgent)1 NodeAgentImpl (com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentImpl)1 NodeAdminStateUpdater (com.yahoo.vespa.hosted.node.admin.provider.NodeAdminStateUpdater)1 IPAddressesImpl (com.yahoo.vespa.hosted.node.admin.task.util.network.IPAddressesImpl)1 Clock (java.time.Clock)1 Duration (java.time.Duration)1 Optional (java.util.Optional)1