use of com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.MissingResourceException in project vespa by vespa-engine.
the class NodeStateRequest method calculateResult.
@Override
public Response.NodeResponse calculateResult(RemoteClusterControllerTask.Context context) throws StateRestApiException {
Response.NodeResponse result = new Response.NodeResponse();
NodeInfo info = context.cluster.getNodeInfo(id.getNode());
if (info == null) {
throw new MissingResourceException("node " + id.getNode());
}
if (info.getGroup() != null) {
result.addAttribute("hierarchical-group", info.getGroup().getPath());
}
result.addState("generated", new Response.UnitStateImpl(context.currentConsolidatedState.getNodeState(id.getNode())));
result.addState("unit", new Response.UnitStateImpl(info.getReportedState()));
result.addState("user", new Response.UnitStateImpl(info.getWantedState()));
for (int i = 0; i < info.getReportedState().getDiskCount(); ++i) {
Id.Partition partitionId = new Id.Partition(id, i);
if (recursive > 0) {
PartitionStateRequest psr = new PartitionStateRequest(partitionId, verboseReports);
result.addEntry("partition", String.valueOf(i), psr.calculateResult(context));
} else {
result.addLink("partition", String.valueOf(i), partitionId.toString());
}
}
return result;
}
Aggregations