Search in sources :

Example 71 with AssetDependencies

use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.

the class BlockProvider method getExportPathStorageSystem.

@SuppressWarnings("incomplete-switch")
@Asset("exportPathStorageSystem")
@AssetDependencies({ "exportPathExport" })
public List<AssetOption> getExportPathStorageSystem(AssetOptionsContext ctx, URI exportId) {
    ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    List<URI> storageSystemIds = new ArrayList<URI>();
    ExportGroupRestRep export = client.blockExports().get(exportId);
    List<ExportBlockParam> volumes = export.getVolumes();
    for (ExportBlockParam volume : volumes) {
        URI resourceId = volume.getId();
        ResourceType volumeType = ResourceType.fromResourceId(resourceId.toString());
        switch(volumeType) {
            case VOLUME:
                VolumeRestRep v = client.blockVolumes().get(resourceId);
                if (v != null) {
                    storageSystemIds.add(v.getStorageController());
                }
                break;
            case BLOCK_SNAPSHOT:
                BlockSnapshotRestRep s = client.blockSnapshots().get(resourceId);
                if (s != null) {
                    storageSystemIds.add(s.getStorageController());
                }
                break;
        }
    }
    List<StorageSystemRestRep> storageSystems = client.storageSystems().getByIds(storageSystemIds);
    for (StorageSystemRestRep storageSystem : storageSystems) {
        String systemType = storageSystem.getSystemType();
        if (Type.vmax.name().equalsIgnoreCase(systemType) || Type.vplex.name().equalsIgnoreCase(systemType)) {
            options.add(new AssetOption(storageSystem.getId(), storageSystem.getName()));
        }
    }
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) ArrayList(java.util.ArrayList) ResourceType(com.emc.sa.util.ResourceType) URI(java.net.URI) ExportBlockParam(com.emc.storageos.model.block.export.ExportBlockParam) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 72 with AssetDependencies

use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.

the class BlockProvider method getPreviewStorageSystem.

@Asset("exportPathPreviewStorageSystem")
@AssetDependencies({ "host", "exportPathVirtualArray", "exportPathExport", "exportPathMinPathsOptions", "exportPathMaxPathsOptions", "exportPathPathsPerInitiatorOptions", "exportPathExistingPath", "exportPathStorageSystem", "exportPathPorts" })
public List<AssetOption> getPreviewStorageSystem(AssetOptionsContext ctx, URI hostOrClusterId, URI vArrayId, URI exportId, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, String useExisting, URI storageSystemId, String ports) {
    List<AssetOption> options = Lists.newArrayList();
    List<URI> exportPathPorts = parseExportPathPorts(ports);
    ExportPathsAdjustmentPreviewRestRep portPreview = generateExportPathPreview(ctx, hostOrClusterId, vArrayId, exportId, minPaths, maxPaths, pathsPerInitiator, useExisting, storageSystemId, exportPathPorts);
    options.add(new AssetOption(portPreview.getStorageSystem(), portPreview.getStorageSystem()));
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) ExportPathsAdjustmentPreviewRestRep(com.emc.storageos.model.block.export.ExportPathsAdjustmentPreviewRestRep) URI(java.net.URI) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 73 with AssetDependencies

use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.

the class BlockProvider method getApplicationVolumes.

@Asset("applicationBlockVolume")
@AssetDependencies("application")
public List<AssetOption> getApplicationVolumes(AssetOptionsContext ctx, URI application) {
    final ViPRCoreClient client = api(ctx);
    List<NamedRelatedResourceRep> volList = client.application().listVolumes(application);
    List<AssetOption> options = new ArrayList<AssetOption>();
    if (volList != null && !volList.isEmpty()) {
        List<VolumeRestRep> allVols = client.blockVolumes().getByRefs(volList);
        Map<String, List<VolumeRestRep>> repGrpVolMap = new HashMap<String, List<VolumeRestRep>>();
        for (VolumeRestRep vol : allVols) {
            if (!BlockProviderUtils.isRPTargetReplicationGroup(vol.getReplicationGroupInstance())) {
                if (repGrpVolMap.get(vol.getReplicationGroupInstance()) == null) {
                    repGrpVolMap.put(vol.getReplicationGroupInstance(), new ArrayList<VolumeRestRep>());
                }
                repGrpVolMap.get(vol.getReplicationGroupInstance()).add(vol);
            }
        }
        for (Entry<String, List<VolumeRestRep>> entry : repGrpVolMap.entrySet()) {
            for (VolumeRestRep vol : entry.getValue()) {
                options.add(new AssetOption(vol.getId(), getMessage("application.volumes.replication_group", vol.getName(), vol.getReplicationGroupInstance())));
            }
        }
    }
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) StoragePortGroupRestRepList(com.emc.storageos.model.portgroup.StoragePortGroupRestRepList) BlockSnapshotSessionList(com.emc.storageos.model.block.BlockSnapshotSessionList) StoragePortList(com.emc.storageos.model.ports.StoragePortList) ArrayList(java.util.ArrayList) VolumeGroupList(com.emc.storageos.model.application.VolumeGroupList) List(java.util.List) NamedVolumesList(com.emc.storageos.model.block.NamedVolumesList) SnapshotList(com.emc.storageos.model.SnapshotList) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 74 with AssetDependencies

use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.

the class BlockProvider method getApplicationFullCopyNamesForSite.

@Asset("siteFullCopyName")
@AssetDependencies({ "application", "applicationVirtualArray" })
public List<AssetOption> getApplicationFullCopyNamesForSite(AssetOptionsContext ctx, URI applicationId, URI applicationVirtualArray) {
    List<VolumeRestRep> fullCopies = getFullCopiesForApplication(ctx, applicationId);
    Set<String> fullCopyNames = new HashSet<String>();
    for (VolumeRestRep vol : fullCopies) {
        if (vol != null && vol.getProtection() != null && vol.getProtection().getFullCopyRep() != null && vol.getProtection().getFullCopyRep().getFullCopySetName() != null && (applicationVirtualArray == null || vol.getVirtualArray().getId().equals(applicationVirtualArray))) {
            fullCopyNames.add(vol.getProtection().getFullCopyRep().getFullCopySetName());
        }
    }
    return createStringOptions(fullCopyNames);
}
Also used : VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) HashSet(java.util.HashSet) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 75 with AssetDependencies

use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.

the class BlockProvider method getExportSnapshotForHostPortGroups.

@Asset("exportSnapshotForHostPortGroups")
@AssetDependencies({ "unassignedBlockSnapshot", "host", "project" })
public List<AssetOption> getExportSnapshotForHostPortGroups(AssetOptionsContext ctx, String selectedSnapshots, URI hostOrClusterId, URI projectId) {
    final ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    SimpleValueRep value = client.customConfigs().getCustomConfigTypeValue(VMAX_PORT_GROUP_ENABLED, VMAX);
    if (value.getValue().equalsIgnoreCase("true")) {
        List<URI> snapshotIds = Lists.newArrayList();
        info("Snapshots selected by user: %s", selectedSnapshots);
        List<String> parsedSnapshotIds = TextUtils.parseCSV(selectedSnapshots);
        for (String id : parsedSnapshotIds) {
            snapshotIds.add(uri(id));
        }
        List<BlockSnapshotRestRep> snapshots = client.blockSnapshots().getByIds(snapshotIds);
        Set<URI> virtualArrays = new HashSet<URI>();
        Set<URI> storageSystems = new HashSet<URI>();
        for (BlockSnapshotRestRep snapshot : snapshots) {
            virtualArrays.add(snapshot.getVirtualArray().getId());
            storageSystems.add(snapshot.getStorageController());
        }
        if (virtualArrays.size() == 1 && storageSystems.size() == 1) {
            Iterator<URI> it = virtualArrays.iterator();
            URI varrayId = it.next();
            ExportGroupRestRep export = findExportGroup(hostOrClusterId, projectId, varrayId, client);
            Iterator<URI> ssIt = storageSystems.iterator();
            StoragePortGroupRestRepList portGroups = client.varrays().getStoragePortGroups(varrayId, export != null ? export.getId() : null, ssIt.next(), null, null, true);
            return createPortGroupOptions(portGroups.getStoragePortGroups());
        }
    }
    return options;
}
Also used : SimpleValueRep(com.emc.storageos.model.customconfig.SimpleValueRep) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) URI(java.net.URI) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) StoragePortGroupRestRepList(com.emc.storageos.model.portgroup.StoragePortGroupRestRepList) HashSet(java.util.HashSet) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Aggregations

Asset (com.emc.sa.asset.annotation.Asset)102 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)102 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)66 AssetOption (com.emc.vipr.model.catalog.AssetOption)63 URI (java.net.URI)43 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)35 ArrayList (java.util.ArrayList)22 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)17 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)13 HashSet (java.util.HashSet)12 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)11 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)11 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)10 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)10 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)10 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)8 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)7 SimpleValueRep (com.emc.storageos.model.customconfig.SimpleValueRep)7 FileVirtualPoolRestRep (com.emc.storageos.model.vpool.FileVirtualPoolRestRep)7 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)6