Search in sources :

Example 11 with FileSystemConfiguration

use of com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration in project cloudbreak by hortonworks.

the class FileSystemViewTest method testGcsFileSystemConfiguration.

@Test
public void testGcsFileSystemConfiguration() {
    FileSystemConfiguration fileSystemConfiguration = TestUtil.gcsFileSystemConfiguration();
    FileSystemView fileSystemView = new FileSystemView(fileSystemConfiguration);
    Assert.assertNotNull(fileSystemView);
    Assert.assertEquals(3, fileSystemView.getProperties().size());
}
Also used : FileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration) Test(org.junit.Test)

Example 12 with FileSystemConfiguration

use of com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration in project cloudbreak by hortonworks.

the class FileSystemViewTest method testWasbIntegratedFileSystemConfiguration.

@Test
public void testWasbIntegratedFileSystemConfiguration() {
    FileSystemConfiguration fileSystemConfiguration = TestUtil.wasbIntegratedFileSystemConfiguration();
    FileSystemView fileSystemView = new FileSystemView(fileSystemConfiguration);
    Assert.assertNotNull(fileSystemView);
    Assert.assertEquals(6, fileSystemView.getProperties().size());
}
Also used : FileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration) Test(org.junit.Test)

Example 13 with FileSystemConfiguration

use of com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration in project cloudbreak by hortonworks.

the class StackRequestToBlueprintPreparationObjectConverter method getFileSystemConfigurationView.

private FileSystemConfigurationView getFileSystemConfigurationView(StackV2Request source) throws IOException {
    FileSystemConfigurationView fileSystemConfigurationView = null;
    if (source.getCluster().getFileSystem() != null) {
        FileSystem fileSystem = getConversionService().convert(source.getCluster().getFileSystem(), FileSystem.class);
        FileSystemConfiguration fileSystemConfiguration = fileSystemConfigurationProvider.fileSystemConfiguration(fileSystem, null);
        fileSystemConfigurationView = new FileSystemConfigurationView(fileSystemConfiguration, source.getCluster().getFileSystem().isDefaultFs());
    }
    return fileSystemConfigurationView;
}
Also used : FileSystemConfigurationView(com.sequenceiq.cloudbreak.blueprint.template.views.FileSystemConfigurationView) FileSystem(com.sequenceiq.cloudbreak.domain.FileSystem) FileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration)

Example 14 with FileSystemConfiguration

use of com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration in project cloudbreak by hortonworks.

the class ClusterTerminationService method deleteFileSystemResources.

private void deleteFileSystemResources(Long stackId, FileSystem fileSystem) {
    try {
        FileSystemConfigurator fsConfigurator = fileSystemConfigurators.get(FileSystemType.valueOf(fileSystem.getType()));
        String json = writeValueAsString(fileSystem.getProperties());
        FileSystemConfiguration fsConfiguration = readValue(json, FileSystemType.valueOf(fileSystem.getType()).getClazz());
        fsConfiguration.addProperty(FileSystemConfiguration.STORAGE_CONTAINER, "cloudbreak" + stackId);
        fsConfigurator.deleteResources(fsConfiguration);
    } catch (IOException e) {
        throw new TerminationFailedException("File system resources could not be deleted: ", e);
    }
}
Also used : FileSystemConfigurator(com.sequenceiq.cloudbreak.blueprint.filesystem.FileSystemConfigurator) JsonUtil.writeValueAsString(com.sequenceiq.cloudbreak.util.JsonUtil.writeValueAsString) IOException(java.io.IOException) TerminationFailedException(com.sequenceiq.cloudbreak.service.stack.flow.TerminationFailedException) FileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration)

Example 15 with FileSystemConfiguration

use of com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration in project cloudbreak by hortonworks.

the class RecipeEngine method addFsRecipesToHostGroups.

private void addFsRecipesToHostGroups(Credential credential, Iterable<HostGroup> hostGroups, String blueprintText, FileSystem fs) throws IOException {
    String scriptName = fs.getType().toLowerCase();
    FileSystemConfigurator fsConfigurator = fileSystemConfigurators.get(FileSystemType.valueOf(fs.getType()));
    FileSystemConfiguration fsConfiguration = getFileSystemConfiguration(fs);
    List<RecipeScript> recipeScripts = fsConfigurator.getScripts(credential, fsConfiguration);
    List<Recipe> fsRecipes = recipeBuilder.buildRecipes(scriptName, recipeScripts);
    for (int i = 0; i < fsRecipes.size(); i++) {
        RecipeScript recipeScript = recipeScripts.get(i);
        Recipe recipe = fsRecipes.get(i);
        for (HostGroup hostGroup : hostGroups) {
            if (ExecutionType.ALL_NODES == recipeScript.getExecutionType()) {
                hostGroup.addRecipe(recipe);
            } else if (ExecutionType.ONE_NODE == recipeScript.getExecutionType() && isComponentPresent(blueprintText, "NAMENODE", hostGroup)) {
                hostGroup.addRecipe(recipe);
                break;
            }
        }
    }
}
Also used : FileSystemConfigurator(com.sequenceiq.cloudbreak.blueprint.filesystem.FileSystemConfigurator) RecipeScript(com.sequenceiq.cloudbreak.common.model.recipe.RecipeScript) Recipe(com.sequenceiq.cloudbreak.domain.Recipe) HostGroup(com.sequenceiq.cloudbreak.domain.HostGroup) FileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration)

Aggregations

FileSystemConfiguration (com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration)15 Test (org.junit.Test)10 RecipeScript (com.sequenceiq.cloudbreak.common.model.recipe.RecipeScript)3 Credential (com.sequenceiq.cloudbreak.domain.Credential)3 FileSystemType (com.sequenceiq.cloudbreak.api.model.FileSystemType)2 FileSystemConfigurator (com.sequenceiq.cloudbreak.blueprint.filesystem.FileSystemConfigurator)2 BlueprintConfigurationEntry (com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry)1 FileSystemConfigurationView (com.sequenceiq.cloudbreak.blueprint.template.views.FileSystemConfigurationView)1 FileSystem (com.sequenceiq.cloudbreak.domain.FileSystem)1 HostGroup (com.sequenceiq.cloudbreak.domain.HostGroup)1 Recipe (com.sequenceiq.cloudbreak.domain.Recipe)1 TerminationFailedException (com.sequenceiq.cloudbreak.service.stack.flow.TerminationFailedException)1 JsonUtil.writeValueAsString (com.sequenceiq.cloudbreak.util.JsonUtil.writeValueAsString)1 IOException (java.io.IOException)1