// For cluster resume/resize, the blueprint is already exist, we need to delete this cluster first.
if (isProvisioned(clusterName) && isClusterProvisionedByBDE(clusterDef)) {
try {
if (hasHosts(clusterName)) {
ApiRequest apiRequestSummary = apiManager.stopAllServicesInCluster(clusterName);
doSoftwareOperation(clusterName, apiRequestSummary, clusterDef.getCurrentReport(), reportQueue);
}
} catch (Exception e) {
logger.error("Failed to stop all services: ", e);
throw SoftwareManagementPluginException.STOP_CLUSTER_EXCEPTION(e, Constants.AMBARI_PLUGIN_NAME, clusterName);
}
apiManager.deleteCluster(clusterName);
}
ApiRequest apiRequestSummary =
apiManager.provisionCluster(clusterDef.getName(),
clusterDef.toApiClusterBlueprint());
ClusterOperationPoller poller =
new ClusterOperationPoller(apiManager, apiRequestSummary,
clusterName, clusterDef.getCurrentReport(), reportQueue,
ProgressSplit.PROVISION_SUCCESS.getProgress());
poller.waitForComplete();
boolean success = false;
ApiRequest apiRequest =
apiManager.getRequest(clusterName, apiRequestSummary
.getApiRequestInfo().getRequestId());
ClusterRequestStatus clusterRequestStatus =
ClusterRequestStatus.valueOf(apiRequest.getApiRequestInfo()
.getRequestStatus());
if (!clusterRequestStatus.isFailedState()) {
success = true;
}
if (!success) {