use of com.sequenceiq.common.api.type.ResourceType in project cloudbreak by hortonworks.
the class InstanceMetaDataService method getAzFromDiskOrNullIfRepair.
@VisibleForTesting
String getAzFromDiskOrNullIfRepair(Stack stack, boolean repair, String instanceGroup, String hostname) {
String availabilityZone = null;
if (repair) {
ResourceType resourceType = getSupportedReattachableDiskType(stack);
if (resourceType != null) {
List<CloudResource> reattachableDiskResources = resourceRetriever.findAllByStatusAndTypeAndStackAndInstanceGroup(CommonStatus.DETACHED, resourceType, stack.getId(), instanceGroup);
Optional<CloudResource> reattachableDiskResource = reattachableDiskResources.stream().filter(d -> d.getParameter(ATTRIBUTES, VolumeSetAttributes.class).getDiscoveryFQDN().equals(hostname)).findFirst();
if (reattachableDiskResource.isPresent()) {
VolumeSetAttributes volumeSetAttributes = reattachableDiskResource.get().getParameter(ATTRIBUTES, VolumeSetAttributes.class);
availabilityZone = volumeSetAttributes.getAvailabilityZone();
LOGGER.debug("Found AZ for the {}: {}", resourceType, availabilityZone);
} else {
LOGGER.debug("Cannot find {} for {} in instanceGroup of {}", resourceType, hostname, instanceGroup);
}
}
}
return availabilityZone;
}
use of com.sequenceiq.common.api.type.ResourceType in project cloudbreak by hortonworks.
the class AzureResourceDeploymentHelperService method pollForCreation.
public void pollForCreation(AuthenticatedContext authenticatedContext, AzureDnsZoneCreationCheckerContext checkerContext) {
try {
azureDnsZoneCreationPoller.startPolling(authenticatedContext, checkerContext);
} catch (CloudConnectorException e) {
LOGGER.warn("Exception during polling: {}", e.getMessage());
} finally {
AzureClient azureClient = checkerContext.getAzureClient();
CommonStatus deploymentStatus = azureClient.getTemplateDeploymentCommonStatus(checkerContext.getResourceGroupName(), checkerContext.getDeploymentName());
ResourceType resourceType = StringUtils.isEmpty(checkerContext.getNetworkId()) ? AZURE_PRIVATE_DNS_ZONE : AZURE_VIRTUAL_NETWORK_LINK;
azureResourcePersistenceHelperService.updateCloudResource(authenticatedContext, checkerContext.getDeploymentName(), checkerContext.getDeploymentId(), deploymentStatus, resourceType);
}
}
Aggregations