use of com.sequenceiq.cloudbreak.service.stack.connector.OperationException in project cloudbreak by hortonworks.
the class ServiceProviderMetadataAdapter method collectMetadata.
public List<CloudVmMetaDataStatus> collectMetadata(Stack stack) {
Location location = location(region(stack.getRegion()), availabilityZone(stack.getAvailabilityZone()));
CloudContext cloudContext = new CloudContext(stack.getId(), stack.getName(), stack.cloudPlatform(), stack.getOwner(), stack.getPlatformVariant(), location);
CloudCredential cloudCredential = credentialConverter.convert(stack.getCredential());
List<CloudInstance> cloudInstances = cloudStackConverter.buildInstances(stack);
List<CloudResource> cloudResources = cloudResourceConverter.convert(stack.getResources());
CollectMetadataRequest cmr = new CollectMetadataRequest(cloudContext, cloudCredential, cloudResources, cloudInstances);
LOGGER.info("Triggering event: {}", cmr);
eventBus.notify(CloudPlatformRequest.selector(CollectMetadataRequest.class), eventFactory.createEvent(cmr));
try {
CollectMetadataResult res = cmr.await();
LOGGER.info("Result: {}", res);
if (res.getErrorDetails() != null) {
LOGGER.error("Failed to collect metadata", res.getErrorDetails());
return Collections.emptyList();
}
return res.getResults();
} catch (InterruptedException e) {
LOGGER.error(format("Error while executing collectMetadata, stack: %s", cloudContext), e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.stack.connector.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getPlatformVariants.
public PlatformVariants getPlatformVariants() {
LOGGER.debug("Get platform variants");
GetPlatformVariantsRequest getPlatformVariantsRequest = new GetPlatformVariantsRequest();
eventBus.notify(getPlatformVariantsRequest.selector(), eventFactory.createEvent(getPlatformVariantsRequest));
try {
GetPlatformVariantsResult res = getPlatformVariantsRequest.await();
LOGGER.info("Platform variants result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.error("Failed to get platform variants", res.getErrorDetails());
throw new OperationException(res.getErrorDetails());
}
return res.getPlatformVariants();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform variants", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.stack.connector.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getRecommendation.
public VmRecommendations getRecommendation(String platform) {
LOGGER.debug("Get platform vm recommendation");
GetVirtualMachineRecommendtaionRequest getVirtualMachineRecommendtaionRequest = new GetVirtualMachineRecommendtaionRequest(platform);
eventBus.notify(getVirtualMachineRecommendtaionRequest.selector(), eventFactory.createEvent(getVirtualMachineRecommendtaionRequest));
try {
GetVirtualMachineRecommendationResponse res = getVirtualMachineRecommendtaionRequest.await();
LOGGER.info("Platform vm recommendation result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.error("Failed to get platform vm recommendation", res.getErrorDetails());
throw new OperationException(res.getErrorDetails());
}
return res.getRecommendations();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform vm recommendation", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.stack.connector.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getCloudAccessConfigs.
public CloudAccessConfigs getCloudAccessConfigs(Credential credential, String region, String variant, Map<String, String> filters) {
LOGGER.debug("Get platform accessConfigs");
ExtendedCloudCredential cloudCredential = credentialToExtendedCloudCredentialConverter.convert(credential);
GetPlatformCloudAccessConfigsRequest getPlatformCloudAccessConfigsRequest = new GetPlatformCloudAccessConfigsRequest(cloudCredential, cloudCredential, variant, region, filters);
eventBus.notify(getPlatformCloudAccessConfigsRequest.selector(), Event.wrap(getPlatformCloudAccessConfigsRequest));
try {
GetPlatformCloudAccessConfigsResult res = getPlatformCloudAccessConfigsRequest.await();
LOGGER.info("Platform accessConfigs result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.error("Failed to get platform accessConfigs", res.getErrorDetails());
throw new GetCloudParameterException("Failed to get access configs for the cloud provider", res.getErrorDetails());
}
return res.getCloudAccessConfigs();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform accessConfigs", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.stack.connector.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getDiskTypes.
public PlatformDisks getDiskTypes() {
LOGGER.debug("Get platform disktypes");
GetDiskTypesRequest getDiskTypesRequest = new GetDiskTypesRequest();
eventBus.notify(getDiskTypesRequest.selector(), eventFactory.createEvent(getDiskTypesRequest));
try {
GetDiskTypesResult res = getDiskTypesRequest.await();
LOGGER.info("Platform disk types result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.error("Failed to get platform disk types", res.getErrorDetails());
throw new OperationException(res.getErrorDetails());
}
return res.getPlatformDisks();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform disk types", e);
throw new OperationException(e);
}
}
Aggregations