use of com.cloudera.api.swagger.ClustersResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerModificationService method deployConfig.
private void deployConfig() throws ApiException, CloudbreakException {
LOGGER.debug("Deploying client configs and refreshing services in Cloudera Manager.");
ClustersResourceApi clustersResourceApi = clouderaManagerApiFactory.getClustersResourceApi(apiClient);
eventService.fireCloudbreakEvent(stack.getId(), UPDATE_IN_PROGRESS.name(), CLUSTER_CM_UPDATING_REMOTE_DATA_CONTEXT);
ApiCommand deployCommand = clustersResourceApi.deployClientConfig(stack.getName());
pollRefresh(deployCommand);
eventService.fireCloudbreakEvent(stack.getId(), UPDATE_IN_PROGRESS.name(), CLUSTER_CM_UPDATED_REMOTE_DATA_CONTEXT);
LOGGER.debug("Deployed client configs and refreshed services in Cloudera Manager.");
}
use of com.cloudera.api.swagger.ClustersResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerModificationService method updateServiceConfigAndRestartService.
@Override
public void updateServiceConfigAndRestartService(String serviceType, String configName, String newConfigValue) throws Exception {
configService.modifyServiceConfig(apiClient, stack.getName(), serviceType, Collections.singletonMap(configName, newConfigValue));
ClustersResourceApi clustersResourceApi = clouderaManagerApiFactory.getClustersResourceApi(apiClient);
restartStaleServices(clustersResourceApi, false);
}
use of com.cloudera.api.swagger.ClustersResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerModificationService method stopCluster.
@Override
public void stopCluster(boolean disableKnoxAutorestart) throws CloudbreakException {
Cluster cluster = stack.getCluster();
ClustersResourceApi clustersResourceApi = clouderaManagerApiFactory.getClustersResourceApi(apiClient);
try {
LOGGER.debug("Stopping all Cloudera Runtime services");
if (clouderaManagerPollingServiceProvider.checkCmStatus(stack, apiClient).isTimeout()) {
skipStopWithStoppedCm();
} else {
stopWithRunningCm(disableKnoxAutorestart, cluster, clustersResourceApi);
}
} catch (ApiException e) {
LOGGER.info("Couldn't stop Cloudera Manager services", e);
throw new ClouderaManagerOperationFailedException(e.getMessage(), e);
}
}
use of com.cloudera.api.swagger.ClustersResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerModificationService method fetchHostNamesFromCm.
private Set<String> fetchHostNamesFromCm(ApiClient v46Client) throws ApiException {
ClustersResourceApi clustersResourceApi = clouderaManagerApiFactory.getClustersResourceApi(v46Client);
String clusterName = stack.getName();
return getClusterHostnamesFromCM(clustersResourceApi, clusterName);
}
use of com.cloudera.api.swagger.ClustersResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerModificationService method doRestartServicesIfNeeded.
private int doRestartServicesIfNeeded(ClustersResourceApi clustersResourceApi, boolean waitForCommandExecutionOnly) throws ApiException, CloudbreakException {
ApiCommandList apiCommandList = clustersResourceApi.listActiveCommands(stack.getName(), SUMMARY);
Optional<ApiCommand> optionalRestartCommand = apiCommandList.getItems().stream().filter(cmd -> "Restart".equals(cmd.getName())).findFirst();
ApiCommand restartCommand = null;
if (optionalRestartCommand.isPresent()) {
restartCommand = optionalRestartCommand.get();
LOGGER.debug("Restart for Cluster services is already running with id: [{}]", restartCommand.getId());
} else if (!waitForCommandExecutionOnly) {
LOGGER.info("Restarting cluster services.");
ApiRestartClusterArgs restartClusterArgs = new ApiRestartClusterArgs();
restartClusterArgs.setRedeployClientConfiguration(true);
restartCommand = clustersResourceApi.restartCommand(stack.getName(), restartClusterArgs);
eventService.fireCloudbreakEvent(stack.getId(), UPDATE_IN_PROGRESS.name(), CLUSTER_CM_CLUSTER_SERVICES_RESTARTING);
}
if (restartCommand != null) {
ExtendedPollingResult pollingResult = clouderaManagerPollingServiceProvider.startPollingCmServicesRestart(stack, apiClient, restartCommand.getId());
handlePollingResult(pollingResult, "Cluster was terminated while restarting services.", "Timeout happened while restarting services.");
}
return getCommandId(restartCommand);
}
Aggregations