Search in sources :

Example 31 with NamedRelatedResourceRep

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

the class StorageSystemUtils method getProtectionConnectivityMap.

public static Map<String, Set<NamedRelatedResourceRep>> getProtectionConnectivityMap(StorageSystemRestRep storageSystem) {
    Map<String, Set<NamedRelatedResourceRep>> connectivityMap = Maps.newTreeMap();
    for (StorageSystemConnectivityRestRep connectivity : getConnectivity(storageSystem)) {
        for (String type : connectivity.getConnectionTypes()) {
            Set<NamedRelatedResourceRep> resources = connectivityMap.get(type);
            if (resources == null) {
                resources = Sets.newTreeSet(new NamedRelatedResourceComparator());
                connectivityMap.put(type, resources);
            }
            resources.add(connectivity.getProtectionSystem());
        }
    }
    return connectivityMap;
}
Also used : StorageSystemConnectivityRestRep(com.emc.storageos.model.systems.StorageSystemConnectivityRestRep) Set(java.util.Set) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Example 32 with NamedRelatedResourceRep

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

the class TenantUtils method getUnmappedNamespace.

public static List<StringOption> getUnmappedNamespace() {
    ObjectNamespaceList objNamespaceList = getViprClient().objectNamespace().getObjectNamespaces();
    List<StringOption> namespaceOptions = Lists.newArrayList();
    List<NamedRelatedResourceRep> ObjNamedList = objNamespaceList.getNamespaces();
    for (NamedRelatedResourceRep namedRes : ObjNamedList) {
        URI uri = namedRes.getId();
        ObjectNamespaceRestRep objNs = getViprClient().objectNamespace().getObjectNamespace(uri);
        if (objNs != null && objNs.getMapped() == false) {
            // only unmapped namespaces to be added to list
            namespaceOptions.add(new StringOption(objNs.getNativeId(), objNs.getNsName()));
        }
    }
    return namespaceOptions;
}
Also used : ObjectNamespaceList(com.emc.storageos.model.object.ObjectNamespaceList) ObjectNamespaceRestRep(com.emc.storageos.model.object.ObjectNamespaceRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 33 with NamedRelatedResourceRep

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

the class VirtualArrayUtils method getConnectivityMap.

public static Map<String, Set<NamedRelatedResourceRep>> getConnectivityMap(String id) {
    Map<String, Set<NamedRelatedResourceRep>> connectivityMap = Maps.newTreeMap();
    for (VirtualArrayConnectivityRestRep connectivity : getConnectivity(id)) {
        for (String type : connectivity.getConnectionType()) {
            Set<NamedRelatedResourceRep> virtualArrays = connectivityMap.get(type);
            if (virtualArrays == null) {
                virtualArrays = Sets.newTreeSet(new NamedRelatedResourceComparator());
                connectivityMap.put(type, virtualArrays);
            }
            virtualArrays.add(connectivity.getVirtualArray());
        }
    }
    return connectivityMap;
}
Also used : VirtualArrayConnectivityRestRep(com.emc.storageos.model.varray.VirtualArrayConnectivityRestRep) TreeSet(java.util.TreeSet) Set(java.util.Set) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Example 34 with NamedRelatedResourceRep

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

the class BlockVolumesDataTable method fetch.

public static List<Volume> fetch(URI projectId, URI applicationId) {
    if (projectId == null && applicationId == null) {
        return Collections.EMPTY_LIST;
    }
    ViPRCoreClient client = getViprClient();
    List<VolumeRestRep> volumes = Lists.newArrayList();
    List<Volume> results = Lists.newArrayList();
    Map<URI, String> virtualArrays = ResourceUtils.mapNames(client.varrays().list());
    Map<URI, String> virtualPools = ResourceUtils.mapNames(client.blockVpools().list());
    if (projectId != null) {
        volumes = client.blockVolumes().findByProject(projectId);
        for (VolumeRestRep volume : volumes) {
            results.add(new Volume(volume, virtualArrays, virtualPools));
        }
    } else if (applicationId != null) {
        List<VolumeRestRep> result = Lists.newArrayList();
        List<NamedRelatedResourceRep> groups = AppSupportUtil.getVolumesByApplication(applicationId.toString());
        List<NamedRelatedResourceRep> clones = AppSupportUtil.getFullCopiesByApplication(applicationId.toString());
        for (NamedRelatedResourceRep volume : groups) {
            result.add(BourneUtil.getViprClient().blockVolumes().get((volume.getId())));
        }
        for (NamedRelatedResourceRep clone : clones) {
            result.add(BourneUtil.getViprClient().blockVolumes().get((clone.getId())));
        }
        for (VolumeRestRep volumeApplication : result) {
            results.add(new Volume(volumeApplication, virtualArrays, virtualPools));
        }
    }
    return results;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) List(java.util.List) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 35 with NamedRelatedResourceRep

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

the class BlockVirtualPoolForm method doSave.

protected BlockVirtualPoolRestRep doSave() {
    BlockVirtualPoolRestRep virtualPool;
    if (isNew()) {
        BlockVirtualPoolBuilder builder = apply(new BlockVirtualPoolBuilder());
        virtualPool = VirtualPoolUtils.create(builder.getVirtualPool());
        this.id = ResourceUtils.stringId(virtualPool);
    } else {
        BlockVirtualPoolRestRep oldVirtualPool = VirtualPoolUtils.getBlockVirtualPool(id);
        BlockVirtualPoolUpdateBuilder builder = apply(new BlockVirtualPoolUpdateBuilder(oldVirtualPool));
        virtualPool = VirtualPoolUtils.update(id, builder.getVirtualPoolUpdate());
        List<NamedRelatedResourceRep> matchingPools = VirtualPoolUtils.refreshMatchingPools(virtualPool);
        Logger.info("Refreshed Block Virtual Pool '%s' matching pools: %d", virtualPool.getName(), matchingPools.size());
    }
    virtualPool = saveStoragePools(virtualPool);
    return virtualPool;
}
Also used : BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) BlockVirtualPoolUpdateBuilder(util.builders.BlockVirtualPoolUpdateBuilder) BlockVirtualPoolBuilder(util.builders.BlockVirtualPoolBuilder)

Aggregations

NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)111 URI (java.net.URI)47 ArrayList (java.util.ArrayList)28 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)22 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)18 Asset (com.emc.sa.asset.annotation.Asset)11 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)11 AssetOption (com.emc.vipr.model.catalog.AssetOption)9 HashMap (java.util.HashMap)8 GET (javax.ws.rs.GET)8 Produces (javax.ws.rs.Produces)8 NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)7 Path (javax.ws.rs.Path)7 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)6 NamedURI (com.emc.storageos.db.client.model.NamedURI)5 SnapshotList (com.emc.storageos.model.SnapshotList)5 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)5 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)5 HashSet (java.util.HashSet)5 List (java.util.List)5