use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileProvider method getFailoverFileTarget.
@Asset("failoverFileTarget")
@AssetDependencies("protectedRemoteFileSystem")
public List<AssetOption> getFailoverFileTarget(AssetOptionsContext ctx, URI protectedFileSystem) {
if (protectedFileSystem != null) {
ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
debug("getting failoverFileTargets (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 VirtualArrayProvider method getFileTargetVirtualArrays.
@Asset("fileTargetVirtualArray")
@AssetDependencies({ "fileFilePolicy", "fileFilesystemAssociation" })
public List<AssetOption> getFileTargetVirtualArrays(AssetOptionsContext context, URI filePolicy, URI fsId) {
ViPRCoreClient client = api(context);
FilePolicyRestRep policyRest = client.fileProtectionPolicies().getFilePolicy(filePolicy);
if (policyRest.getType().equals("file_snapshot")) {
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;
} else {
return getFileVirtualArrays(context);
}
}
use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class VMwareDatastoreTagger method addDatastoreTagsToFilesystem.
public Integer addDatastoreTagsToFilesystem(URI filesystemId, URI vcenterId, URI datacenterId, String datastoreName, String nfsMountPoint) {
final FileShareRestRep filesystem = client.fileSystems().get(filesystemId);
final MachineTagsCollection tags = getFileSystemTags(filesystem);
for (int i = 1; i < Integer.MAX_VALUE; i++) {
MachineTag datastoreTag = tags.find(NAMESPACE, DATASTORE, i);
if (datastoreTag == null) {
final Integer index = Integer.valueOf(i);
final DatastoreMachineTag tag = new DatastoreMachineTag(index, vcenterId.toString(), datacenterId.toString(), datastoreName, nfsMountPoint);
addDatastoreTagsToFilesystem(filesystemId, tag);
return Integer.valueOf(i);
}
}
throw new IllegalStateException("Attempt to find a valid index to use for this datastore tag failed. All values from 1 up to Integer.MAX_VALUE are being used.");
}
use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileSystemsDataTable method fetch.
public static List<FileSystem> fetch(URI projectId) {
if (projectId == null) {
return Collections.EMPTY_LIST;
}
ViPRCoreClient client = getViprClient();
List<FileShareRestRep> fileSystems = client.fileSystems().findByProject(projectId);
Map<URI, String> virtualArrays = ResourceUtils.mapNames(client.varrays().list());
Map<URI, String> virtualPools = ResourceUtils.mapNames(client.fileVpools().list());
List<FileSystem> results = Lists.newArrayList();
for (FileShareRestRep fileSystem : fileSystems) {
results.add(new FileSystem(fileSystem, virtualArrays, virtualPools));
}
return results;
}
use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class DeleteFileSystemHelper method deleteFileSystems.
public void deleteFileSystems() {
if (fileDeletionType == null) {
fileDeletionType = FileControllerConstants.DeleteTypeEnum.FULL;
}
for (FileShareRestRep fs : fileSystems) {
URI fsId = fs.getId();
FileStorageUtils.deleteFileSystem(fsId, fileDeletionType);
}
}
Aggregations