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"));
}
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"));
}
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);
}
}
Aggregations