use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileProvider method getFailbackFileTarget.
@Asset("failbackFileTarget")
@AssetDependencies("protectedRemoteFileSystem")
public List<AssetOption> getFailbackFileTarget(AssetOptionsContext ctx, URI protectedFileSystem) {
if (protectedFileSystem != null) {
ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
debug("getting failbackFileTargets (protectedFileSystem=%s)", protectedFileSystem);
FileShareRestRep file = client.fileSystems().get(protectedFileSystem);
FileProtectionRestRep protection = file.getProtection();
if (protection != null) {
List<VirtualArrayRelatedResourceRep> targets = protection.getTargetFileSystems();
for (VirtualArrayRelatedResourceRep target : targets) {
FileShareRestRep fileshare = client.fileSystems().get(target.getId());
options.add(new AssetOption(fileshare.getId(), fileshare.getName()));
}
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
return Lists.newArrayList();
}
use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileProvider method getSubDir.
private String getSubDir(AssetOptionsContext ctx, ExportRule export) {
FileShareRestRep fs = api(ctx).fileSystems().get(export.getFsID());
String subDir = export.getExportPath().replace(fs.getMountPath(), "");
if (subDir.startsWith("/")) {
subDir = subDir.replaceFirst("/", "");
}
return subDir;
}
use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileProvider method getFileFilesystemSourceArrayForAssociation.
@Asset("fileFilesystemSourceArray")
@AssetDependencies("fileFilesystemAssociation")
public List<AssetOption> getFileFilesystemSourceArrayForAssociation(AssetOptionsContext ctx, URI fsId) {
ViPRCoreClient client = api(ctx);
VirtualArrayRestRep vArray = null;
List<AssetOption> options = Lists.newArrayList();
FileShareRestRep fsObj = client.fileSystems().get(fsId);
if (fsObj != null) {
vArray = client.varrays().get(fsObj.getVirtualArray().getId());
options.add(createBaseResourceOption(vArray));
}
return options;
}
use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileProvider method createFilesystemOptions.
/**
* Create filesystem options from the list of filesystems, filtering using the given predicate
*
* @return The list of AssetOptions
*/
protected List<AssetOption> createFilesystemOptions(Collection<FileShareRestRep> filesystems, Predicate predicate) {
CollectionUtils.filter(filesystems, predicate);
List<AssetOption> options = Lists.newArrayList();
for (FileShareRestRep fs : filesystems) {
options.add(new AssetOption(fs.getId(), getLabel(fs)));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileProvider method getExportedFilesystems.
// For mount operation
@Asset("fileExportedFilesystem")
@AssetDependencies("project")
public List<AssetOption> getExportedFilesystems(AssetOptionsContext ctx, URI project) {
List<FileShareRestRep> filesystems = api(ctx).fileSystems().findByProject(project);
List<FileShareRestRep> exportedFS = new ArrayList<FileShareRestRep>();
for (FileShareRestRep fs : filesystems) {
if (!api(ctx).fileSystems().getExports(fs.getId()).isEmpty()) {
exportedFS.add(fs);
}
}
return createFilesystemOptions(exportedFS, null);
}
Aggregations