use of com.sequenceiq.cloudbreak.reactor.api.event.orchestration.RemoveHostsFailed in project cloudbreak by hortonworks.
the class RemoveHostsHandler method accept.
@Override
public void accept(Event<RemoveHostsRequest> removeHostsRequestEvent) {
RemoveHostsRequest request = removeHostsRequestEvent.getData();
Set<String> hostNames = request.getHostNames();
Selectable result;
try {
Stack stack = stackService.getByIdWithListsInTransaction(request.getResourceId());
if (stack.getPrimaryGatewayInstance() != null && stack.getPrimaryGatewayInstance().isReachable()) {
List<GatewayConfig> allGatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack);
PollingResult orchestratorRemovalPollingResult = removeHostsFromOrchestrator(stack, new ArrayList<>(hostNames), hostOrchestrator, allGatewayConfigs);
if (!orchestratorRemovalPollingResult.isSuccess()) {
LOGGER.warn("Can not remove hosts from orchestrator: {}", hostNames);
}
} else {
LOGGER.warn("Primary gateway is not reachable, can't remove hosts from orchestrator");
}
result = new RemoveHostsSuccess(request.getResourceId(), request.getHostGroupNames(), hostNames);
} catch (Exception e) {
result = new RemoveHostsFailed(removeHostsRequestEvent.getData().getResourceId(), e, request.getHostGroupNames(), hostNames);
}
eventBus.notify(result.selector(), new Event<>(removeHostsRequestEvent.getHeaders(), result));
}
use of com.sequenceiq.cloudbreak.reactor.api.event.orchestration.RemoveHostsFailed in project cloudbreak by hortonworks.
the class ClusterDownscaleActions method updateInstanceMetadataOrchestrationFailedAction.
@Bean(name = "REMOVE_HOSTS_FROM_ORCHESTRATION_FAILED_STATE")
public Action<?, ?> updateInstanceMetadataOrchestrationFailedAction() {
return new AbstractClusterAction<>(RemoveHostsFailed.class) {
@Override
protected void doExecute(ClusterViewContext context, RemoveHostsFailed payload, Map<Object, Object> variables) {
clusterDownscaleService.updateMetadataStatusToFailed(payload);
sendEvent(context, FAILURE_EVENT.event(), new StackFailureEvent(payload.getResourceId(), payload.getException()));
}
};
}
Aggregations