use of com.cloudera.api.swagger.ParcelResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerUpgradeParcelDownloadListenerTask method getApiParcel.
private ApiParcel getApiParcel(ClouderaManagerCommandPollerObject pollerObject) throws ApiException {
ApiClient apiClient = pollerObject.getApiClient();
ParcelResourceApi parcelResourceApi = clouderaManagerApiPojoFactory.getParcelResourceApi(apiClient);
return parcelResourceApi.readParcel(parcelResource.getClusterName(), parcelResource.getProduct(), parcelResource.getVersion());
}
use of com.cloudera.api.swagger.ParcelResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerSingleParcelActivationListenerTask method doStatusCheck.
@Override
protected boolean doStatusCheck(ClouderaManagerCommandPollerObject pollerObject) throws ApiException {
ApiClient apiClient = pollerObject.getApiClient();
ParcelResourceApi parcelResourceApi = clouderaManagerApiPojoFactory.getParcelResourceApi(apiClient);
String parcelStatus = getParcelStatus(pollerObject, parcelResourceApi);
if (ParcelStatus.ACTIVATED.name().equals(parcelStatus)) {
LOGGER.debug("{} parcel is activated.", product.getName());
return true;
} else {
LOGGER.debug("{} [{}] parcel is not yet activated. Current status: {}.", product.getName(), product.getVersion(), parcelStatus);
return false;
}
}
use of com.cloudera.api.swagger.ParcelResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerModificationService method downloadAndDistributeParcels.
@Override
public void downloadAndDistributeParcels(Set<ClusterComponent> components, boolean patchUpgrade) throws CloudbreakException {
try {
ParcelResourceApi parcelResourceApi = clouderaManagerApiFactory.getParcelResourceApi(apiClient);
ClouderaManagerResourceApi clouderaManagerResourceApi = clouderaManagerApiFactory.getClouderaManagerResourceApi(apiClient);
checkParcelApiAvailability();
Set<ClouderaManagerProduct> products = getProducts(components);
LOGGER.info("The following products will be downloaded and distributed: {}", products);
setParcelRepo(products, clouderaManagerResourceApi);
refreshParcelRepos(clouderaManagerResourceApi);
if (patchUpgrade) {
LOGGER.info("Downloading parcels for {} products...", products);
downloadAndActivateParcels(products, parcelResourceApi, false);
} else {
ClouderaManagerProduct cdhProduct = clouderaManagerProductsProvider.getCdhProducts(products);
upgradeNonCdhProducts(products, cdhProduct.getName(), parcelResourceApi, false);
downloadAndActivateParcels(Collections.singleton(cdhProduct), parcelResourceApi, false);
}
} catch (ApiException e) {
LOGGER.info("Error during downloading parcels!", e);
throw new ClouderaManagerOperationFailedException(e.getMessage(), e);
}
}
use of com.cloudera.api.swagger.ParcelResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerModificationService method upgradeClusterRuntime.
@Override
public void upgradeClusterRuntime(Set<ClusterComponent> components, boolean patchUpgrade, Optional<String> remoteDataContext) throws CloudbreakException {
try {
LOGGER.info("Starting to upgrade cluster runtimes. Patch upgrade: {}", patchUpgrade);
ClustersResourceApi clustersResourceApi = clouderaManagerApiFactory.getClustersResourceApi(apiClient);
ParcelResourceApi parcelResourceApi = clouderaManagerApiFactory.getParcelResourceApi(apiClient);
ClouderaManagerResourceApi clouderaManagerResourceApi = clouderaManagerApiFactory.getClouderaManagerResourceApi(apiClient);
startClouderaManager();
startAgents();
tagHostsWithHostTemplateName();
checkParcelApiAvailability();
refreshRemoteDataContextFromDatalakeInCaseOfDatahub(remoteDataContext);
Set<ClouderaManagerProduct> products = getProducts(components);
setParcelRepo(products, clouderaManagerResourceApi);
refreshParcelRepos(clouderaManagerResourceApi);
restartMgmtServices();
if (patchUpgrade) {
downloadAndActivateParcels(products, parcelResourceApi, true);
startServices();
callPostClouderaRuntimeUpgradeCommandIfCMIsNewerThan751(clustersResourceApi);
restartServices(clustersResourceApi);
} else {
ClouderaManagerProduct cdhProduct = clouderaManagerProductsProvider.getCdhProducts(products);
upgradeNonCdhProducts(products, cdhProduct.getName(), parcelResourceApi, true);
upgradeCdh(clustersResourceApi, parcelResourceApi, cdhProduct);
startServices();
deployConfigAndRefreshCMStaleServices(clustersResourceApi, false);
}
removeUnusedParcelVersions(parcelResourceApi, products);
configService.enableKnoxAutorestartIfCmVersionAtLeast(CLOUDERAMANAGER_VERSION_7_1_0, apiClient, stack.getName());
LOGGER.info("Cluster runtime upgrade finished");
} catch (ApiException e) {
LOGGER.info("Could not upgrade Cloudera Runtime services", e);
throw new ClouderaManagerOperationFailedException(e.getMessage(), e);
}
}
use of com.cloudera.api.swagger.ParcelResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerModificationService method removeUnusedParcels.
@Override
public ParcelOperationStatus removeUnusedParcels(Set<ClusterComponent> usedParcelComponents, Set<String> parcelNamesFromImage) {
ParcelsResourceApi parcelsResourceApi = clouderaManagerApiFactory.getParcelsResourceApi(apiClient);
ParcelResourceApi parcelResourceApi = clouderaManagerApiFactory.getParcelResourceApi(apiClient);
Set<String> usedParcelComponentNames = usedParcelComponents.stream().map(component -> component.getAttributes().getSilent(ClouderaManagerProduct.class).getName()).collect(Collectors.toSet());
ParcelOperationStatus deactivateStatus = clouderaManagerParcelDecommissionService.deactivateUnusedParcels(parcelsResourceApi, parcelResourceApi, stack.getName(), usedParcelComponentNames, parcelNamesFromImage);
ParcelOperationStatus undistributeStatus = clouderaManagerParcelDecommissionService.undistributeUnusedParcels(apiClient, parcelsResourceApi, parcelResourceApi, stack, usedParcelComponentNames, parcelNamesFromImage);
ParcelOperationStatus removalStatus = clouderaManagerParcelDecommissionService.removeUnusedParcels(apiClient, parcelsResourceApi, parcelResourceApi, stack, usedParcelComponentNames, parcelNamesFromImage);
ParcelOperationStatus result = removalStatus.merge(deactivateStatus).merge(undistributeStatus);
LOGGER.info("Result of the parcel removal: {}", result);
return result;
}
Aggregations