Search in sources :

Example 26 with FileShareRestRep

use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.

the class FileProvider method getUnprotectedFileSystems.

@Asset("unprotectedFilesystem")
@AssetDependencies({ "project" })
public List<AssetOption> getUnprotectedFileSystems(AssetOptionsContext ctx, URI project) {
    debug("getting unprotected file system (project=%s)", project);
    ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    List<FileShareRestRep> fileSystems = client.fileSystems().findByProject(project);
    for (FileShareRestRep fileShare : fileSystems) {
        if (fileShare.getProtection() != null && fileShare.getProtection().getPersonality() == null) {
            options.add(new AssetOption(fileShare.getId(), fileShare.getName()));
        }
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 27 with FileShareRestRep

use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.

the class FileProvider method getSnapshotFilesystems.

@Asset("fileSnapshotFilesystem")
@AssetDependencies({ "project" })
public List<AssetOption> getSnapshotFilesystems(AssetOptionsContext ctx, URI project) {
    ViPRCoreClient client = api(ctx);
    Collection<FileShareRestRep> filesystems = client.fileSystems().findByProject(project);
    Map<URI, FileVirtualPoolRestRep> pools = getFileVirtualPools(client, filesystems);
    return createFilesystemOptions(filesystems, new SnapableFilesystemsPredicate(pools));
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) URI(java.net.URI) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 28 with FileShareRestRep

use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.

the class FileProvider method getProtectedFileSystems.

@Asset("protectedRemoteFileSystem")
@AssetDependencies({ "project" })
public List<AssetOption> getProtectedFileSystems(AssetOptionsContext ctx, URI project) {
    debug("getting protected remote file system (project=%s)", project);
    ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    List<FileShareRestRep> fileSystems = client.fileSystems().findByProject(project);
    for (FileShareRestRep fileShare : fileSystems) {
        if (fileShare.getProtection() != null && StringUtils.equals(FileShare.PersonalityTypes.SOURCE.toString(), fileShare.getProtection().getPersonality())) {
            options.add(new AssetOption(fileShare.getId(), fileShare.getName()));
        }
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 29 with FileShareRestRep

use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.

the class VirtualArrayProvider method getTargetVirtualArrays.

@Asset("fileTargetVirtualArray")
@AssetDependencies({ "fileFilePolicy", "unprotectedFilesystem" })
public List<AssetOption> getTargetVirtualArrays(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);
    }
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) FilePolicyRestRep(com.emc.storageos.model.file.policy.FilePolicyRestRep) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 30 with FileShareRestRep

use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.

the class VMwareDatastoreTagger method removeDatastoreTagsFromFilesystem.

private void removeDatastoreTagsFromFilesystem(URI filesystemId, Integer index) {
    final FileShareRestRep filesystem = client.fileSystems().get(filesystemId);
    final MachineTagsCollection tags = getFileSystemTags(filesystem);
    final MachineTagsCollection removeTags = tags.findTags(NAMESPACE, index, DATASTORE, MOUNT_POINT, VCENTER, DATACENTER);
    client.fileSystems().removeTags(filesystemId, removeTags.generateRawTags());
}
Also used : MachineTagsCollection(com.emc.sa.machinetags.MachineTagsCollection) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep)

Aggregations

FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)66 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)27 URI (java.net.URI)15 Asset (com.emc.sa.asset.annotation.Asset)13 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)13 AssetOption (com.emc.vipr.model.catalog.AssetOption)10 ArrayList (java.util.ArrayList)7 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)6 FileProtectionRestRep (com.emc.storageos.model.file.FileShareRestRep.FileProtectionRestRep)5 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)5 Task (com.emc.vipr.client.Task)4 FlashException (controllers.util.FlashException)4 CreateFileSystem (com.emc.sa.service.vipr.file.tasks.CreateFileSystem)3 DeactivateFileSystem (com.emc.sa.service.vipr.file.tasks.DeactivateFileSystem)3 DeactivateFileSystemExportRule (com.emc.sa.service.vipr.file.tasks.DeactivateFileSystemExportRule)3 FileSystemDeleteParam (com.emc.storageos.model.file.FileSystemDeleteParam)3 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)3 FileVirtualPoolRestRep (com.emc.storageos.model.vpool.FileVirtualPoolRestRep)3 MachineTagsCollection (com.emc.sa.machinetags.MachineTagsCollection)2 DeactivateFileSystemShare (com.emc.sa.service.vipr.file.tasks.DeactivateFileSystemShare)2