use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.
the class BlockProvider method getTargetVplexVolumeVirtualArrays.
@Asset("targetVirtualArray")
@AssetDependencies("project")
public List<AssetOption> getTargetVplexVolumeVirtualArrays(AssetOptionsContext ctx, URI projectId) {
ViPRCoreClient client = api(ctx);
List<AssetOption> targets = Lists.newArrayList();
for (VirtualArrayRestRep varray : client.varrays().getByTenant(ctx.getTenant())) {
targets.add(createBaseResourceOption(varray));
}
return targets;
}
use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.
the class BlockProvider method getExportPathStorageSystem.
@SuppressWarnings("incomplete-switch")
@Asset("exportPathStorageSystem")
@AssetDependencies({ "exportPathExport" })
public List<AssetOption> getExportPathStorageSystem(AssetOptionsContext ctx, URI exportId) {
ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
List<URI> storageSystemIds = new ArrayList<URI>();
ExportGroupRestRep export = client.blockExports().get(exportId);
List<ExportBlockParam> volumes = export.getVolumes();
for (ExportBlockParam volume : volumes) {
URI resourceId = volume.getId();
ResourceType volumeType = ResourceType.fromResourceId(resourceId.toString());
switch(volumeType) {
case VOLUME:
VolumeRestRep v = client.blockVolumes().get(resourceId);
if (v != null) {
storageSystemIds.add(v.getStorageController());
}
break;
case BLOCK_SNAPSHOT:
BlockSnapshotRestRep s = client.blockSnapshots().get(resourceId);
if (s != null) {
storageSystemIds.add(s.getStorageController());
}
break;
}
}
List<StorageSystemRestRep> storageSystems = client.storageSystems().getByIds(storageSystemIds);
for (StorageSystemRestRep storageSystem : storageSystems) {
String systemType = storageSystem.getSystemType();
if (Type.vmax.name().equalsIgnoreCase(systemType) || Type.vplex.name().equalsIgnoreCase(systemType)) {
options.add(new AssetOption(storageSystem.getId(), storageSystem.getName()));
}
}
return options;
}
use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.
the class BlockProvider method createExportWithVarrayOptions.
protected static List<AssetOption> createExportWithVarrayOptions(ViPRCoreClient client, Collection<? extends ExportGroupRestRep> exportObjects) {
List<URI> varrayIds = getExportVirtualArrayIds(exportObjects);
Map<URI, VirtualArrayRestRep> varrayNames = getVirutalArrayNames(client, varrayIds);
List<AssetOption> options = Lists.newArrayList();
for (ExportGroupRestRep export : exportObjects) {
options.add(createExportWithVarrayOption(export, varrayNames));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.
the class BlockProvider method getPreviewStorageSystem.
@Asset("exportPathPreviewStorageSystem")
@AssetDependencies({ "host", "exportPathVirtualArray", "exportPathExport", "exportPathMinPathsOptions", "exportPathMaxPathsOptions", "exportPathPathsPerInitiatorOptions", "exportPathExistingPath", "exportPathStorageSystem", "exportPathPorts" })
public List<AssetOption> getPreviewStorageSystem(AssetOptionsContext ctx, URI hostOrClusterId, URI vArrayId, URI exportId, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, String useExisting, URI storageSystemId, String ports) {
List<AssetOption> options = Lists.newArrayList();
List<URI> exportPathPorts = parseExportPathPorts(ports);
ExportPathsAdjustmentPreviewRestRep portPreview = generateExportPathPreview(ctx, hostOrClusterId, vArrayId, exportId, minPaths, maxPaths, pathsPerInitiator, useExisting, storageSystemId, exportPathPorts);
options.add(new AssetOption(portPreview.getStorageSystem(), portPreview.getStorageSystem()));
return options;
}
use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.
the class BlockProvider method getApplicationVolumes.
@Asset("applicationBlockVolume")
@AssetDependencies("application")
public List<AssetOption> getApplicationVolumes(AssetOptionsContext ctx, URI application) {
final ViPRCoreClient client = api(ctx);
List<NamedRelatedResourceRep> volList = client.application().listVolumes(application);
List<AssetOption> options = new ArrayList<AssetOption>();
if (volList != null && !volList.isEmpty()) {
List<VolumeRestRep> allVols = client.blockVolumes().getByRefs(volList);
Map<String, List<VolumeRestRep>> repGrpVolMap = new HashMap<String, List<VolumeRestRep>>();
for (VolumeRestRep vol : allVols) {
if (!BlockProviderUtils.isRPTargetReplicationGroup(vol.getReplicationGroupInstance())) {
if (repGrpVolMap.get(vol.getReplicationGroupInstance()) == null) {
repGrpVolMap.put(vol.getReplicationGroupInstance(), new ArrayList<VolumeRestRep>());
}
repGrpVolMap.get(vol.getReplicationGroupInstance()).add(vol);
}
}
for (Entry<String, List<VolumeRestRep>> entry : repGrpVolMap.entrySet()) {
for (VolumeRestRep vol : entry.getValue()) {
options.add(new AssetOption(vol.getId(), getMessage("application.volumes.replication_group", vol.getName(), vol.getReplicationGroupInstance())));
}
}
}
return options;
}
Aggregations