use of com.sequenceiq.cloudbreak.cloud.model.VolumeParameterType.EPHEMERAL in project cloudbreak by hortonworks.
the class AzurePlatformResources method collectInstanceStorageCount.
public InstanceStoreMetadata collectInstanceStorageCount(AuthenticatedContext ac, List<String> instanceTypes) {
try {
AzureClient client = azureClientService.getClient(ac.getCloudCredential());
Set<VirtualMachineSize> vmTypes = client.getVmTypes(ac.getCloudContext().getLocation().getRegion().value());
Map<String, VolumeParameterConfig> instanceTypeToInstanceStorageMap = vmTypes.stream().filter(vmType -> instanceTypes.contains(vmType.name())).filter(vmType -> vmType.resourceDiskSizeInMB() != NO_RESOURCE_DISK_ATTACHED_TO_INSTANCE).collect(Collectors.toMap(VirtualMachineSize::name, vmType -> new VolumeParameterConfig(EPHEMERAL, (int) (vmType.resourceDiskSizeInMB() / NO_MB_PER_GB), (int) (vmType.resourceDiskSizeInMB() / NO_MB_PER_GB), 1, 1)));
return new InstanceStoreMetadata(instanceTypeToInstanceStorageMap);
} catch (Exception e) {
LOGGER.warn("Failed to get vm type data: {}", instanceTypes, e);
throw new CloudConnectorException(e.getMessage(), e);
}
}
Aggregations