Search in sources :

Example 6 with VirtualArrayRelatedResourceRep

use of com.emc.storageos.model.VirtualArrayRelatedResourceRep 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();
}
Also used : FileProtectionRestRep(com.emc.storageos.model.file.FileShareRestRep.FileProtectionRestRep) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) VirtualArrayRelatedResourceRep(com.emc.storageos.model.VirtualArrayRelatedResourceRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 7 with VirtualArrayRelatedResourceRep

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

the class AffectedResources method getFileMirror.

private static List<FileShareRestRep> getFileMirror(ViPRCoreClient client, URI id) {
    try {
        if (id != null) {
            List<FileShareRestRep> fileMirrors = new ArrayList<FileShareRestRep>();
            FileProtectionRestRep targetFileSystems = client.fileSystems().get(id).getProtection();
            for (VirtualArrayRelatedResourceRep virtualResource : targetFileSystems.getTargetFileSystems()) {
                fileMirrors.add(client.fileSystems().get(virtualResource.getId()));
            }
            return fileMirrors;
        }
    } catch (Exception e) {
        Logger.debug(e, "Failed to retrieve file system: %s", id);
    }
    return null;
}
Also used : FileProtectionRestRep(com.emc.storageos.model.file.FileShareRestRep.FileProtectionRestRep) ArrayList(java.util.ArrayList) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) VirtualArrayRelatedResourceRep(com.emc.storageos.model.VirtualArrayRelatedResourceRep)

Example 8 with VirtualArrayRelatedResourceRep

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

the class FileStorageUtils method getMirrorFileSystems.

public static List<URI> getMirrorFileSystems(URI fileSystem) {
    FileShareRestRep fileShare = getFileSystem(fileSystem);
    List<URI> targetFS = new ArrayList<>();
    if (fileShare.getProtection() != null && fileShare.getProtection().getTargetFileSystems() != null) {
        List<VirtualArrayRelatedResourceRep> responses = fileShare.getProtection().getTargetFileSystems();
        for (VirtualArrayRelatedResourceRep resp : responses) {
            targetFS.add(resp.getId());
        }
    }
    return targetFS;
}
Also used : ArrayList(java.util.ArrayList) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) URI(java.net.URI) VirtualArrayRelatedResourceRep(com.emc.storageos.model.VirtualArrayRelatedResourceRep)

Example 9 with VirtualArrayRelatedResourceRep

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

the class BlockMapper method toTargetVolumeRelatedResource.

private static VirtualArrayRelatedResourceRep toTargetVolumeRelatedResource(ResourceTypeEnum type, URI id, URI parentId, URI varray) {
    VirtualArrayRelatedResourceRep resourceRep = new VirtualArrayRelatedResourceRep();
    if (NullColumnValueGetter.isNullURI(id)) {
        return null;
    }
    resourceRep.setId(id);
    resourceRep.setLink(toLink(type, id, parentId));
    resourceRep.setVirtualArray(toRelatedResource(ResourceTypeEnum.VARRAY, varray));
    return resourceRep;
}
Also used : VirtualArrayRelatedResourceRep(com.emc.storageos.model.VirtualArrayRelatedResourceRep)

Example 10 with VirtualArrayRelatedResourceRep

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

the class FileMapper method toTargetFileSystemRelatedResource.

private static VirtualArrayRelatedResourceRep toTargetFileSystemRelatedResource(ResourceTypeEnum type, URI id, URI varray) {
    VirtualArrayRelatedResourceRep resourceRep = new VirtualArrayRelatedResourceRep();
    if (NullColumnValueGetter.isNullURI(id)) {
        return null;
    }
    resourceRep.setId(id);
    resourceRep.setLink(toLink(type, id));
    resourceRep.setVirtualArray(toRelatedResource(ResourceTypeEnum.VARRAY, varray));
    return resourceRep;
}
Also used : VirtualArrayRelatedResourceRep(com.emc.storageos.model.VirtualArrayRelatedResourceRep)

Aggregations

VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)12 ArrayList (java.util.ArrayList)7 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)6 FileProtectionRestRep (com.emc.storageos.model.file.FileShareRestRep.FileProtectionRestRep)5 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)5 AssetOption (com.emc.vipr.model.catalog.AssetOption)5 Asset (com.emc.sa.asset.annotation.Asset)4 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)4 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)4 URI (java.net.URI)4 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)2 ProtectionRestRep (com.emc.storageos.model.block.VolumeRestRep.ProtectionRestRep)2 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)2 CachedResources (com.emc.vipr.client.core.util.CachedResources)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 NamedURI (com.emc.storageos.db.client.model.NamedURI)1 StringSet (com.emc.storageos.db.client.model.StringSet)1 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)1 Volume (com.emc.storageos.db.client.model.Volume)1