use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class BlockProvider method getApplicationVirtualArrays.
@Asset("applicationVirtualArray")
@AssetDependencies("application")
public List<AssetOption> getApplicationVirtualArrays(AssetOptionsContext ctx, URI applicationId) {
final ViPRCoreClient client = api(ctx);
List<NamedRelatedResourceRep> volList = client.application().listVolumes(applicationId);
List<AssetOption> options = new ArrayList<AssetOption>();
boolean isRP = false;
URI sourceVarrayId = null;
List<VolumeRestRep> allRPSourceVols = null;
if (volList != null && !volList.isEmpty()) {
VolumeRestRep vol = client.blockVolumes().get(volList.get(0));
if (BlockProviderUtils.isVolumeRP(vol)) {
isRP = true;
allRPSourceVols = client.blockVolumes().getByRefs(volList, RecoverPointPersonalityFilter.SOURCE);
if (allRPSourceVols != null && !allRPSourceVols.isEmpty()) {
VolumeRestRep rpvol = allRPSourceVols.get(0);
sourceVarrayId = rpvol.getVirtualArray().getId();
}
}
} else {
options.add(newAssetOption(URI.create("none"), "None"));
return options;
}
// if the volumes are RP (vplex or not) add the RP targets as options
if (isRP) {
options.add(newAssetOption(sourceVarrayId, "protection.site.type.source"));
Set<URI> targetVarrayIds = new HashSet<URI>();
List<AssetOption> targetOptions = new ArrayList<AssetOption>();
List<VolumeRestRep> allRPTargetVols = client.blockVolumes().getByRefs(volList, RecoverPointPersonalityFilter.TARGET);
for (VolumeRestRep targetVol : allRPTargetVols) {
targetVarrayIds.add(targetVol.getVirtualArray().getId());
}
List<VirtualArrayRestRep> targetVarrays = client.varrays().getByIds(targetVarrayIds);
for (VirtualArrayRestRep targetVarray : targetVarrays) {
targetOptions.add(newAssetOption(String.format("tgt:%s", targetVarray.getId().toString()), "protection.site.type.target", targetVarray.getName()));
}
// sort the targets
AssetOptionsUtils.sortOptionsByLabel(targetOptions);
options.addAll(targetOptions);
}
if (options.isEmpty()) {
options.add(newAssetOption(URI.create("none"), "None"));
}
return options;
}
use of com.emc.storageos.model.NamedRelatedResourceRep 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.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class GetMobilityGroupVolumesByHost method getHostExportedVolumes.
private Set<URI> getHostExportedVolumes() {
Set<URI> volumes = Sets.newHashSet();
for (NamedRelatedResourceRep host : hosts) {
List<ExportGroupRestRep> exports = getClient().blockExports().findContainingHost(host.getId());
volumes.addAll(BlockProviderUtils.getExportedResourceIds(exports, ResourceType.VOLUME));
}
return volumes;
}
use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method getReplicationGroupSnapshotSessions.
public static Table<URI, String, BlockSnapshotSessionRestRep> getReplicationGroupSnapshotSessions(List<NamedRelatedResourceRep> volumeUris) {
Table<URI, String, BlockSnapshotSessionRestRep> storageRgToVolumes = HashBasedTable.create();
for (NamedRelatedResourceRep volumeUri : volumeUris) {
BlockSnapshotSessionRestRep snapshotSession = execute(new GetBlockSnapshotSession(volumeUri.getId()));
String rgName = snapshotSession.getReplicationGroupInstance();
URI storage = snapshotSession.getStorageController();
if (!storageRgToVolumes.contains(storage, rgName)) {
storageRgToVolumes.put(storage, rgName, snapshotSession);
}
}
return storageRgToVolumes;
}
use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method getAllFullCopyVolumes.
public static List<URI> getAllFullCopyVolumes(URI applicationId, String copySet, List<String> subGroups) {
List<URI> fullCopyIds = Lists.newArrayList();
List<NamedRelatedResourceRep> fullCopies = execute(new GetFullCopyList(applicationId, copySet)).getVolumes();
for (NamedRelatedResourceRep fullCopy : fullCopies) {
fullCopyIds.add(fullCopy.getId());
}
return fullCopyIds;
}
Aggregations