Search in sources :

Example 1 with NodeAttributes

use of com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAttributes in project vespa by vespa-engine.

the class RealNodeRepositoryTest method testUpdateNodeAttributes.

@Test
public void testUpdateNodeAttributes() throws InterruptedException, IOException {
    waitForJdiscContainerToServe();
    NodeRepository nodeRepositoryApi = new RealNodeRepository(configServerApi);
    String hostname = "host4.yahoo.com";
    nodeRepositoryApi.updateNodeAttributes(hostname, new NodeAttributes().withRestartGeneration(1L).withDockerImage(new DockerImage("image-1:6.2.3")).withVespaVersion("6.2.3"));
}
Also used : NodeAttributes(com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAttributes) DockerImage(com.yahoo.vespa.hosted.dockerapi.DockerImage) Test(org.junit.Test)

Example 2 with NodeAttributes

use of com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAttributes in project vespa by vespa-engine.

the class RealNodeRepositoryTest method testUpdateNodeAttributesWithBadValue.

@Test(expected = RuntimeException.class)
public void testUpdateNodeAttributesWithBadValue() throws InterruptedException, IOException {
    waitForJdiscContainerToServe();
    NodeRepository nodeRepositoryApi = new RealNodeRepository(configServerApi);
    String hostname = "host4.yahoo.com";
    nodeRepositoryApi.updateNodeAttributes(hostname, new NodeAttributes().withRestartGeneration(1L).withDockerImage(new DockerImage("image-1")).withVespaVersion("6.2.3\n"));
}
Also used : NodeAttributes(com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAttributes) DockerImage(com.yahoo.vespa.hosted.dockerapi.DockerImage) Test(org.junit.Test)

Example 3 with NodeAttributes

use of com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAttributes in project vespa by vespa-engine.

the class NodeAdminStateUpdaterImpl method updateHardwareDivergence.

private void updateHardwareDivergence(StorageMaintainer maintainer) {
    if (currentState != RESUMED)
        return;
    try {
        ContainerNodeSpec nodeSpec = nodeRepository.getContainerNodeSpec(dockerHostHostName).orElseThrow(() -> new RuntimeException("Failed to get host's node spec from node-repo"));
        String hardwareDivergence = maintainer.getHardwareDivergence(nodeSpec);
        // Only update hardware divergence if there is a change.
        if (!nodeSpec.hardwareDivergence.orElse("null").equals(hardwareDivergence)) {
            NodeAttributes nodeAttributes = new NodeAttributes().withHardwareDivergence(hardwareDivergence);
            nodeRepository.updateNodeAttributes(dockerHostHostName, nodeAttributes);
        }
    } catch (RuntimeException e) {
        log.log(Level.WARNING, "Failed to report hardware divergence", e);
    }
}
Also used : NodeAttributes(com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAttributes) ContainerNodeSpec(com.yahoo.vespa.hosted.node.admin.ContainerNodeSpec)

Aggregations

NodeAttributes (com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAttributes)3 DockerImage (com.yahoo.vespa.hosted.dockerapi.DockerImage)2 Test (org.junit.Test)2 ContainerNodeSpec (com.yahoo.vespa.hosted.node.admin.ContainerNodeSpec)1