Search in sources :

Example 6 with BlockMirrorRestRep

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

the class BlockProvider method constructCopiesOptions.

protected List<AssetOption> constructCopiesOptions(ViPRCoreClient client, URI project, List<BlockMirrorRestRep> copies) {
    List<AssetOption> options = Lists.newArrayList();
    for (BlockMirrorRestRep copy : copies) {
        options.add(new AssetOption(copy.getId(), getBlockObjectLabel(client, copy, null)));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) BlockMirrorRestRep(com.emc.storageos.model.block.BlockMirrorRestRep)

Example 7 with BlockMirrorRestRep

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

the class BlockProvider method getExportedBlockContinuousCopyByVolume.

@Asset("exportedBlockContinuousCopy")
@AssetDependencies({ "project", "volumeWithContinuousCopies" })
public List<AssetOption> getExportedBlockContinuousCopyByVolume(AssetOptionsContext ctx, URI project, URI volume) {
    debug("getting exported blockContinuousCopy (project=%s) (parent=%s)", project, volume);
    final ViPRCoreClient client = api(ctx);
    Set<URI> exportedMirrors = new HashSet<URI>();
    for (ExportGroupRestRep export : client.blockExports().findByProject(project)) {
        for (ExportBlockParam resource : export.getVolumes()) {
            if (ResourceType.isType(ResourceType.BLOCK_CONTINUOUS_COPY, resource.getId())) {
                exportedMirrors.add(resource.getId());
            }
        }
    }
    ExportedBlockResourceFilter<BlockMirrorRestRep> exportedMirrorFilter = new ExportedBlockResourceFilter<BlockMirrorRestRep>(exportedMirrors);
    List<BlockMirrorRestRep> mirrors = client.blockVolumes().getContinuousCopies(volume, exportedMirrorFilter);
    return createVolumeOptions(client, mirrors);
}
Also used : ExportBlockParam(com.emc.storageos.model.block.export.ExportBlockParam) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) BlockMirrorRestRep(com.emc.storageos.model.block.BlockMirrorRestRep) URI(java.net.URI) HashSet(java.util.HashSet) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 8 with BlockMirrorRestRep

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

the class BlockProvider method getExportContinousCopyForHostPortGroups.

@Asset("exportContinousCopyForHostPortGroups")
@AssetDependencies({ "volumeWithContinuousCopies", "unassignedBlockContinuousCopies", "host", "project" })
public List<AssetOption> getExportContinousCopyForHostPortGroups(AssetOptionsContext ctx, URI volumeId, String selectedCopies, 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("Continous Copies selected by user: %s", selectedCopies);
        List<String> parsedCopiesIds = TextUtils.parseCSV(selectedCopies);
        for (String id : parsedCopiesIds) {
            snapshotIds.add(uri(id));
        }
        List<BlockMirrorRestRep> copies = client.blockVolumes().getContinuousCopies(volumeId);
        Set<URI> virtualArrays = new HashSet<URI>();
        Set<URI> storageSystems = new HashSet<URI>();
        Set<URI> virtualPools = new HashSet<URI>();
        for (BlockMirrorRestRep copy : copies) {
            virtualArrays.add(copy.getVirtualArray().getId());
            storageSystems.add(copy.getStorageController());
            virtualPools.add(copy.getVirtualPool().getId());
        }
        if (virtualArrays.size() == 1 && storageSystems.size() == 1 && virtualPools.size() == 1) {
            Iterator<URI> it = virtualArrays.iterator();
            URI varrayId = it.next();
            ExportGroupRestRep export = findExportGroup(hostOrClusterId, projectId, varrayId, client);
            Iterator<URI> ssIt = storageSystems.iterator();
            Iterator<URI> vpIt = virtualPools.iterator();
            StoragePortGroupRestRepList portGroups = client.varrays().getStoragePortGroups(varrayId, export != null ? export.getId() : null, ssIt.next(), vpIt.next(), 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) BlockMirrorRestRep(com.emc.storageos.model.block.BlockMirrorRestRep) 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)

Example 9 with BlockMirrorRestRep

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

the class BlockProvider method getContinuousCopyOptionsForProject.

private List<AssetOption> getContinuousCopyOptionsForProject(AssetOptionsContext ctx, URI project, URI volumeId, ResourceFilter<BlockMirrorRestRep> filter) {
    ViPRCoreClient client = api(ctx);
    List<BlockMirrorRestRep> copies = client.blockVolumes().getContinuousCopies(volumeId, filter);
    return constructCopiesOptions(client, project, copies);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockMirrorRestRep(com.emc.storageos.model.block.BlockMirrorRestRep)

Aggregations

BlockMirrorRestRep (com.emc.storageos.model.block.BlockMirrorRestRep)9 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)4 URI (java.net.URI)3 Asset (com.emc.sa.asset.annotation.Asset)2 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)2 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)2 SimpleValueRep (com.emc.storageos.model.customconfig.SimpleValueRep)2 AssetOption (com.emc.vipr.model.catalog.AssetOption)2 HashSet (java.util.HashSet)2 GetActiveContinuousCopiesForVolume (com.emc.sa.service.vipr.block.tasks.GetActiveContinuousCopiesForVolume)1 GetBlockVirtualPool (com.emc.sa.service.vipr.block.tasks.GetBlockVirtualPool)1 GetVMAXUsePortGroupEnabledConfig (com.emc.sa.service.vipr.block.tasks.GetVMAXUsePortGroupEnabledConfig)1 BlockMirror (com.emc.storageos.db.client.model.BlockMirror)1 VplexMirror (com.emc.storageos.db.client.model.VplexMirror)1 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)1 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)1 SOURCE_TO_TARGET (com.emc.storageos.model.block.Copy.SyncDirection.SOURCE_TO_TARGET)1 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)1 ExportBlockParam (com.emc.storageos.model.block.export.ExportBlockParam)1 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)1