use of com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.InternalFailure in project vespa by vespa-engine.
the class Request method doRemoteFleetControllerTask.
@Override
public final void doRemoteFleetControllerTask(Context context) {
try {
if (masterState == MasterState.MUST_BE_MASTER && !context.masterInfo.isMaster()) {
Integer masterIndex = context.masterInfo.getMaster();
if (masterIndex == null)
throw new UnknownMasterException();
throw new OtherMasterIndexException(masterIndex);
}
result = calculateResult(context);
resultSet = true;
} catch (OtherMasterIndexException | StateRestApiException e) {
failure = e;
} catch (Exception e) {
failure = new InternalFailure("Caught unexpected exception");
failure.initCause(e);
}
}
use of com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.InternalFailure in project vespa by vespa-engine.
the class SetNodeStatesForClusterRequest method calculateResult.
@Override
public SetResponse calculateResult(RemoteClusterControllerTask.Context context) throws StateRestApiException {
if (condition != SetUnitStateRequest.Condition.FORCE) {
// go down, etc. This is prohibited in Condition.SAFE.
throw new InvalidContentException("Setting all nodes in a cluster to a state is only supported with FORCE");
}
for (ConfiguredNode configuredNode : context.cluster.getConfiguredNodes().values()) {
Node node = new Node(NodeType.STORAGE, configuredNode.index());
SetResponse setResponse = SetNodeStateRequest.setWantedState(context.cluster, condition, newStates, node, context.nodeStateOrHostInfoChangeHandler, context.currentConsolidatedState);
if (!setResponse.getWasModified()) {
throw new InternalFailure("We have not yet implemented the meaning of " + "failing to set the wanted state for a subset of nodes: " + "condition = " + condition + ", newStates = " + newStates + ", currentConsolidatedState = " + context.currentConsolidatedState);
}
}
// 'true' here means the current state now equals the request's wanted state.
return new SetResponse("ok", true);
}
Aggregations