Search in sources :

Example 1 with CloudFileSystemView

use of com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView in project cloudbreak by hortonworks.

the class CloudStorageConverter method requestToSpiFileSystem.

public SpiFileSystem requestToSpiFileSystem(CloudStorageBase cloudStorageRequest) {
    List<CloudFileSystemView> cloudFileSystemViews = new ArrayList<>();
    FileSystemType type = null;
    if (cloudStorageRequest.getIdentities() != null && !cloudStorageRequest.getIdentities().isEmpty()) {
        for (StorageIdentityBase storageIdentity : cloudStorageRequest.getIdentities()) {
            type = getCloudFileSystemView(cloudStorageRequest, cloudFileSystemViews, storageIdentity);
        }
    }
    validateCloudFileSystemViews(cloudFileSystemViews, type);
    return new SpiFileSystem("", type, cloudFileSystemViews);
}
Also used : FileSystemType(com.sequenceiq.common.model.FileSystemType) CloudFileSystemView(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView) ArrayList(java.util.ArrayList) SpiFileSystem(com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem) StorageIdentityBase(com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)

Example 2 with CloudFileSystemView

use of com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView in project cloudbreak by hortonworks.

the class AzureSetup method validateFileSystem.

@Override
public void validateFileSystem(CloudCredential credential, SpiFileSystem spiFileSystem) throws Exception {
    FileSystemType fileSystemType = spiFileSystem.getType();
    List<CloudFileSystemView> cloudFileSystems = spiFileSystem.getCloudFileSystems();
    if (cloudFileSystems.size() > 2) {
        throw new CloudConnectorException("More than 2 file systems (identities) are not yet supported on Azure!");
    }
    if (cloudFileSystems.isEmpty()) {
        LOGGER.info("No filesystem was configured.");
        return;
    }
    if (FileSystemType.ADLS.equals(fileSystemType)) {
        validateAdlsFileSystem(credential, spiFileSystem);
    } else if (FileSystemType.ADLS_GEN_2.equals(fileSystemType)) {
        validateAdlsGen2FileSystem(spiFileSystem);
    } else {
        validateWasbFileSystem(spiFileSystem);
    }
}
Also used : CloudConnectorException(com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException) FileSystemType(com.sequenceiq.common.model.FileSystemType) CloudFileSystemView(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView)

Example 3 with CloudFileSystemView

use of com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView in project cloudbreak by hortonworks.

the class StackToCloudStackConverter method buildFileSystemView.

public Optional<CloudFileSystemView> buildFileSystemView(Stack stack) {
    Telemetry telemetry = stack.getTelemetry();
    Backup backup = stack.getBackup();
    Optional<CloudFileSystemView> fileSystemView = Optional.empty();
    if (telemetry != null && telemetry.getLogging() != null && backup != null) {
        checkLoggingAndBackupFileSystemConflicting(telemetry.getLogging(), backup);
    }
    if (telemetry != null && telemetry.getLogging() != null) {
        fileSystemView = buildFileSystemViewFromTelemetry(telemetry.getLogging());
    }
    if (fileSystemView.isEmpty() && backup != null) {
        fileSystemView = buildFileSystemViewFromBackup(backup);
    }
    return fileSystemView;
}
Also used : Backup(com.sequenceiq.freeipa.api.model.Backup) CloudFileSystemView(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry)

Example 4 with CloudFileSystemView

use of com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView in project cloudbreak by hortonworks.

the class StackToCloudStackConverter method buildInstances.

public List<CloudInstance> buildInstances(Stack stack) {
    ImageEntity imageEntity = imageService.getByStack(stack);
    Optional<CloudFileSystemView> fileSystemView = buildFileSystemView(stack);
    List<Group> groups = buildInstanceGroups(stack, Lists.newArrayList(stack.getInstanceGroups()), Collections.emptySet(), imageEntity.getImageName(), fileSystemView);
    List<CloudInstance> cloudInstances = new ArrayList<>();
    for (Group group : groups) {
        cloudInstances.addAll(group.getInstances());
    }
    return cloudInstances;
}
Also used : Group(com.sequenceiq.cloudbreak.cloud.model.Group) AzureResourceGroup(com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureResourceGroup) InstanceGroup(com.sequenceiq.freeipa.entity.InstanceGroup) ImageEntity(com.sequenceiq.freeipa.entity.ImageEntity) CloudFileSystemView(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView) ArrayList(java.util.ArrayList) CloudInstance(com.sequenceiq.cloudbreak.cloud.model.CloudInstance)

Example 5 with CloudFileSystemView

use of com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView in project cloudbreak by hortonworks.

the class StackToCloudStackConverter method convert.

public CloudStack convert(Stack stack, Collection<String> deleteRequestedInstances) {
    Image image = imageConverter.convert(imageService.getByStack(stack));
    Optional<CloudFileSystemView> fileSystemView = buildFileSystemView(stack);
    List<Group> instanceGroups = buildInstanceGroups(stack, Lists.newArrayList(stack.getInstanceGroups()), deleteRequestedInstances, image.getImageName(), fileSystemView);
    Network network = buildNetwork(stack);
    InstanceAuthentication instanceAuthentication = buildInstanceAuthentication(stack.getStackAuthentication());
    Map<String, String> parameters = buildCloudStackParameters(stack.getEnvironmentCrn());
    return new CloudStack(instanceGroups, network, image, parameters, getUserDefinedTags(stack), stack.getTemplate(), instanceAuthentication, instanceAuthentication.getLoginUserName(), instanceAuthentication.getPublicKey(), null);
}
Also used : Group(com.sequenceiq.cloudbreak.cloud.model.Group) AzureResourceGroup(com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureResourceGroup) InstanceGroup(com.sequenceiq.freeipa.entity.InstanceGroup) InstanceAuthentication(com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication) InstanceGroupNetwork(com.sequenceiq.freeipa.entity.InstanceGroupNetwork) GroupNetwork(com.sequenceiq.cloudbreak.cloud.model.GroupNetwork) Network(com.sequenceiq.cloudbreak.cloud.model.Network) CloudFileSystemView(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView) Image(com.sequenceiq.cloudbreak.cloud.model.Image) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack)

Aggregations

CloudFileSystemView (com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView)18 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 Set (java.util.Set)4 Group (com.sequenceiq.cloudbreak.cloud.model.Group)3 SpiFileSystem (com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem)3 InstanceGroup (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)3 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)3 CloudIdentityType (com.sequenceiq.common.model.CloudIdentityType)3 Backup (com.sequenceiq.freeipa.api.model.Backup)3 HashSet (java.util.HashSet)3 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)2 InstanceAuthentication (com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication)2 CloudGcsView (com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudGcsView)2 FileSystem (com.sequenceiq.cloudbreak.domain.FileSystem)2 CloudIdentity (com.sequenceiq.cloudbreak.domain.cloudstorage.CloudIdentity)2 CloudStorage (com.sequenceiq.cloudbreak.domain.cloudstorage.CloudStorage)2 Logging (com.sequenceiq.common.api.telemetry.model.Logging)2 FileSystemType (com.sequenceiq.common.model.FileSystemType)2 AzureResourceGroup (com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureResourceGroup)2