use of org.apache.cloudstack.ha.SimulatorHAState in project cloudstack by apache.
the class ConfigureSimulatorHAProviderState method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
final Host host = _resourceService.getHost(getHostId());
if (host == null) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find host by ID: " + getHostId());
}
final SimulatorHAState haState = new SimulatorHAState(healthy, activity, recovery, fenceable);
final SimulatorHAProvider simulatorHAProvider = (SimulatorHAProvider) haManager.getHAProvider(SimulatorHAProvider.class.getSimpleName().toLowerCase());
if (simulatorHAProvider != null) {
simulatorHAProvider.setHAStateForHost(host.getId(), haState);
}
final SuccessResponse response = new SuccessResponse();
response.setSuccess(simulatorHAProvider != null);
response.setResponseName(getCommandName());
response.setObjectName("simulatorhaprovider");
setResponseObject(response);
}
Aggregations