Search in sources :

Example 1 with InitiatorPortMapRestRep

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

the class BlockProvider method getResultingPaths.

@Asset("exportPathResultingPaths")
@AssetDependencies({ "host", "exportPathVirtualArray", "exportPathExport", "exportPathMinPathsOptions", "exportPathMaxPathsOptions", "exportPathPathsPerInitiatorOptions", "exportPathExistingPath", "exportPathStorageSystem", "exportPathPorts" })
public List<AssetOption> getResultingPaths(AssetOptionsContext ctx, URI hostOrClusterId, URI vArrayId, URI exportId, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, String useExisting, URI storageSystemId, String ports) {
    List<URI> exportPathPorts = parseExportPathPorts(ports);
    ExportPathsAdjustmentPreviewRestRep portPreview = generateExportPathPreview(ctx, hostOrClusterId, vArrayId, exportId, minPaths, maxPaths, pathsPerInitiator, useExisting, storageSystemId, exportPathPorts);
    List<InitiatorPortMapRestRep> addedList = portPreview.getAdjustedPaths();
    return buildPathOptions(ctx, addedList, "exportPathAdjustment.resultingPaths");
}
Also used : InitiatorPortMapRestRep(com.emc.storageos.model.block.export.InitiatorPortMapRestRep) 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 2 with InitiatorPortMapRestRep

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

the class BlockProvider method getRemovedPaths.

@Asset("exportPathRemovedPaths")
@AssetDependencies({ "host", "exportPathVirtualArray", "exportPathExport", "exportPathMinPathsOptions", "exportPathMaxPathsOptions", "exportPathPathsPerInitiatorOptions", "exportPathExistingPath", "exportPathStorageSystem", "exportPathPorts" })
public List<AssetOption> getRemovedPaths(AssetOptionsContext ctx, URI hostOrClusterId, URI vArrayId, URI exportId, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, String useExisting, URI storageSystemId, String ports) {
    List<URI> exportPathPorts = parseExportPathPorts(ports);
    ExportPathsAdjustmentPreviewRestRep portPreview = generateExportPathPreview(ctx, hostOrClusterId, vArrayId, exportId, minPaths, maxPaths, pathsPerInitiator, useExisting, storageSystemId, exportPathPorts);
    List<InitiatorPortMapRestRep> removedList = portPreview.getRemovedPaths();
    return buildPathOptions(ctx, removedList, "exportPathAdjustment.removedPaths");
}
Also used : InitiatorPortMapRestRep(com.emc.storageos.model.block.export.InitiatorPortMapRestRep) 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 3 with InitiatorPortMapRestRep

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

the class ExportPathAdjustmentService method runExportPathsPreview.

private void runExportPathsPreview() {
    ExportPathsAdjustmentPreviewRestRep previewRestRep = execute(new ExportPathsPreview(host, virtualArray, exportId, minPaths, maxPaths, pathsPerInitiator, storageSystem, ports));
    List<InitiatorPortMapRestRep> affectedPaths = previewRestRep.getAdjustedPaths();
    List<InitiatorPortMapRestRep> removedPaths = previewRestRep.getRemovedPaths();
    // build the affected path
    for (InitiatorPortMapRestRep ipm : affectedPaths) {
        List<URI> portList = new ArrayList<URI>();
        for (NamedRelatedResourceRep port : ipm.getStoragePorts()) {
            portList.add(port.getId());
        }
        resultingPathsMap.put(ipm.getInitiator().getId(), portList);
    }
    // build the removed path
    for (InitiatorPortMapRestRep ipm : removedPaths) {
        List<URI> portList = new ArrayList<URI>();
        for (NamedRelatedResourceRep port : ipm.getStoragePorts()) {
            portList.add(port.getId());
        }
        removedPathsMap.put(ipm.getInitiator().getId(), portList);
    }
}
Also used : InitiatorPortMapRestRep(com.emc.storageos.model.block.export.InitiatorPortMapRestRep) ExportPathsAdjustmentPreviewRestRep(com.emc.storageos.model.block.export.ExportPathsAdjustmentPreviewRestRep) ArrayList(java.util.ArrayList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI) ExportPathsPreview(com.emc.sa.service.vipr.block.tasks.ExportPathsPreview)

Example 4 with InitiatorPortMapRestRep

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

the class BlockProvider method buildPathOptions.

/* helper for building the list of asset option for affected and removed paths */
private List<AssetOption> buildPathOptions(AssetOptionsContext ctx, List<InitiatorPortMapRestRep> list, String message) {
    ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    for (InitiatorPortMapRestRep ipm : list) {
        InitiatorRestRep initiator = ipm.getInitiator();
        List<NamedRelatedResourceRep> ports = ipm.getStoragePorts();
        String portList = new String(" ");
        List<URI> portURIs = new ArrayList<URI>();
        for (NamedRelatedResourceRep port : ports) {
            StoragePortRestRep p = client.storagePorts().get(port.getId());
            portList += p.getPortName() + " ";
            portURIs.add(port.getId());
        }
        Map<URI, List<URI>> key = new HashMap<URI, List<URI>>();
        key.put(initiator.getId(), portURIs);
        String label = getMessage(message, initiator.getHostName(), initiator.getName(), portList);
        String keyString = EMPTY_STRING;
        try {
            keyString = CatalogSerializationUtils.serializeToString(key);
        } catch (Exception ex) {
        }
        options.add(new AssetOption(keyString, label));
    }
    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) StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep) URI(java.net.URI) InitiatorPortMapRestRep(com.emc.storageos.model.block.export.InitiatorPortMapRestRep) 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)

Example 5 with InitiatorPortMapRestRep

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

the class ExportGroupService method addRetainedPathsFromHosts.

/**
 * Add the existing paths from hosts that will not be provisioned into the rest response.
 * @param response -- The ExportPathsAdjustmentPreviewResponse being constructed
 * @param existingPathMap -- A map of initiator URI string to a set of port URI strings representing existing paths.
 * @param hosts --Set of host URIs
 */
private void addRetainedPathsFromHosts(ExportPathsAdjustmentPreviewRestRep response, StringSetMap existingPathMap, Set<URI> hosts) {
    // all hosts will be provisioned.
    if (hosts.isEmpty()) {
        return;
    }
    // existing paths for the initiator.
    for (String initiatorId : existingPathMap.keySet()) {
        Initiator initiator = _dbClient.queryObject(Initiator.class, URI.create(initiatorId));
        if (initiator == null || initiator.getInactive() || hosts.contains(initiator.getHost())) {
            continue;
        }
        InitiatorPortMapRestRep zone = new InitiatorPortMapRestRep();
        zone.setInitiator(HostMapper.map(initiator));
        for (String portId : existingPathMap.get(initiatorId)) {
            StoragePort port = queryObject(StoragePort.class, URI.create(portId), false);
            zone.getStoragePorts().add(toNamedRelatedResource(port, port.getPortName()));
        }
        response.getAdjustedPaths().add(zone);
    }
}
Also used : InitiatorPortMapRestRep(com.emc.storageos.model.block.export.InitiatorPortMapRestRep) Initiator(com.emc.storageos.db.client.model.Initiator) StoragePort(com.emc.storageos.db.client.model.StoragePort)

Aggregations

InitiatorPortMapRestRep (com.emc.storageos.model.block.export.InitiatorPortMapRestRep)7 URI (java.net.URI)6 ExportPathsAdjustmentPreviewRestRep (com.emc.storageos.model.block.export.ExportPathsAdjustmentPreviewRestRep)4 Initiator (com.emc.storageos.db.client.model.Initiator)3 StoragePort (com.emc.storageos.db.client.model.StoragePort)3 ArrayList (java.util.ArrayList)3 Asset (com.emc.sa.asset.annotation.Asset)2 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)2 NamedURI (com.emc.storageos.db.client.model.NamedURI)2 StringSet (com.emc.storageos.db.client.model.StringSet)2 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)2 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)2 List (java.util.List)2 ExportPathsPreview (com.emc.sa.service.vipr.block.tasks.ExportPathsPreview)1 BulkList (com.emc.storageos.api.service.impl.response.BulkList)1 SearchedResRepList (com.emc.storageos.api.service.impl.response.SearchedResRepList)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)1 ExportMask (com.emc.storageos.db.client.model.ExportMask)1 ExportPathParams (com.emc.storageos.db.client.model.ExportPathParams)1