use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class BaseAssetOptionsProvider method createNamedResourceOptions.
protected List<AssetOption> createNamedResourceOptions(Collection<? extends NamedRelatedResourceRep> values) {
List<AssetOption> options = Lists.newArrayList();
for (NamedRelatedResourceRep value : values) {
options.add(createNamedResourceOption(value));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class BlockProvider method getExportPathPorts.
@Asset("exportPathPorts")
@AssetDependencies({ "exportPathVirtualArray", "exportPathStorageSystem", "exportPathExport" })
public List<AssetOption> getExportPathPorts(AssetOptionsContext ctx, URI vArrayId, URI storageSystemId, URI exportId) {
ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
// Get all the PGs for the varray/storage system/EG combo then check to
// see if there are any non-mutable PGs;
// if there are the storage ports displayed to the user would be limited
// to just those ones.
StoragePortGroupRestRepList portGroupsRestRep = client.varrays().getStoragePortGroups(vArrayId, exportId, storageSystemId, null, null, false);
// Keep a list of ports from the non-mutable PGs. This could remain
// empty if there are no PGs or none that are non-mutable.
List<URI> nonMutablePGPortURIs = new ArrayList<URI>();
if (portGroupsRestRep != null) {
// Drill down to get the PG and the storage ports
List<StoragePortGroupRestRep> portGroups = portGroupsRestRep.getStoragePortGroups();
if (!CollectionUtils.isEmpty(portGroups)) {
for (StoragePortGroupRestRep pg : portGroups) {
// Check to see if the PG is non-mutable
if (!pg.getMutable()) {
// Keep track of these storage ports, they will be used
// to filter out
// other storage ports.
StoragePortList pgPortsList = pg.getStoragePorts();
List<NamedRelatedResourceRep> pgPorts = pgPortsList.getPorts();
for (NamedRelatedResourceRep pgPort : pgPorts) {
nonMutablePGPortURIs.add(pgPort.getId());
}
}
}
}
}
List<StoragePortRestRep> ports = client.storagePorts().getByVirtualArray(vArrayId);
for (StoragePortRestRep port : ports) {
// Check to see if this port needs to be filtered out.
boolean filterOutPortBasedOnPG = (!nonMutablePGPortURIs.isEmpty()) ? !nonMutablePGPortURIs.contains(port.getId()) : false;
if (!filterOutPortBasedOnPG) {
if (port.getPortType().equals(StoragePort.PortType.frontend.toString()) && port.getStorageDevice().getId().equals(storageSystemId) && port.getOperationalStatus().equals(StoragePort.OperationalStatus.OK.toString())) {
if (port.getNetwork() != null) {
String portPercentBusy = (port.getPortPercentBusy() != null) ? String.valueOf(Math.round(port.getPortPercentBusy() * 100 / 100)) + "%" : "N/A";
String networkName = client.networks().get(port.getNetwork().getId()).getName();
String label = getMessage("exportPathAdjustment.ports", port.getPortName(), networkName, port.getPortNetworkId(), portPercentBusy);
options.add(new AssetOption(port.getId(), label));
}
}
}
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class BlockProvider method getAffectedExports.
@Asset("exportPathAffectedExports")
@AssetDependencies({ "host", "exportPathVirtualArray", "exportPathExport", "exportPathMinPathsOptions", "exportPathMaxPathsOptions", "exportPathPathsPerInitiatorOptions", "exportPathExistingPath", "exportPathStorageSystem", "exportPathPorts" })
public List<AssetOption> getAffectedExports(AssetOptionsContext ctx, URI hostOrClusterId, URI vArrayId, URI exportId, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, String useExisting, URI storageSystemId, String ports) {
ViPRCoreClient client = api(ctx);
// the asset option list
List<AssetOption> options = Lists.newArrayList();
List<URI> exportPathPorts = parseExportPathPorts(ports);
ExportPathsAdjustmentPreviewRestRep portPreview = generateExportPathPreview(ctx, hostOrClusterId, vArrayId, exportId, minPaths, maxPaths, pathsPerInitiator, useExisting, storageSystemId, exportPathPorts);
List<NamedRelatedResourceRep> affectedList = portPreview.getAffectedExportGroups();
List<URI> exportIds = new ArrayList<URI>();
for (NamedRelatedResourceRep affected : affectedList) {
exportIds.add(affected.getId());
}
List<ExportGroupRestRep> exports = client.blockExports().getByIds(exportIds);
for (ExportGroupRestRep export : exports) {
// TODO: need to optimize the way that we retrieve the project name.
String projectName = client.projects().get(export.getProject().getId()).getName();
String label = getMessage("exportPathAdjustment.affectedExports", projectName, export.getName());
options.add(new AssetOption(export.getName(), label));
}
return options;
}
use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class BlockProvider method getReplicationGroupsForApplicationSnapshotSession.
protected Set<String> getReplicationGroupsForApplicationSnapshotSession(ViPRCoreClient client, URI applicationId, String copySet) {
Set<String> options = Sets.newHashSet();
VolumeGroupCopySetParam input = new VolumeGroupCopySetParam();
input.setCopySetName(copySet);
BlockSnapshotSessionList sessions = client.application().getVolumeGroupSnapshotSessionsByCopySet(applicationId, input);
for (NamedRelatedResourceRep session : sessions.getSnapSessionRelatedResourceList()) {
BlockSnapshotSessionRestRep sessionRep = client.blockSnapshotSessions().get(session);
if (sessionRep != null && sessionRep.getReplicationGroupInstance() != null) {
options.add(sessionRep.getReplicationGroupInstance());
}
}
return BlockStorageUtils.stripRPTargetFromReplicationGroup(options);
}
use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class BlockProvider method getReplicationGroupsForApplicationFullCopy.
protected Set<String> getReplicationGroupsForApplicationFullCopy(ViPRCoreClient client, URI applicationId, String copySet) {
Set<String> options = Sets.newHashSet();
VolumeGroupCopySetParam input = new VolumeGroupCopySetParam();
input.setCopySetName(copySet);
NamedVolumesList fullCopies = client.application().getVolumeGroupFullCopiesForSet(applicationId, input);
for (NamedRelatedResourceRep fullCopy : fullCopies.getVolumes()) {
VolumeRestRep fullCopyRep = client.blockVolumes().get(fullCopy);
if (fullCopyRep != null && fullCopyRep.getReplicationGroupInstance() != null) {
options.add(fullCopyRep.getReplicationGroupInstance());
}
}
return options;
}
Aggregations