use of com.sequenceiq.cloudbreak.blueprint.filesystem.FileSystemConfigurator 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);
}
}
use of com.sequenceiq.cloudbreak.blueprint.filesystem.FileSystemConfigurator 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;
}
}
}
}
Aggregations