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");
}
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");
}
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);
}
}
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;
}
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);
}
}
Aggregations