use of com.emc.storageos.model.block.export.ExportBlockParam in project coprhd-controller by CoprHD.
the class BlockExportGroupVolumesDataTable method fetch.
public static List<Volume> fetch(URI exportGroupID) {
if (exportGroupID == null) {
return Collections.emptyList();
}
ViPRCoreClient client = BourneUtil.getViprClient();
ExportGroupRestRep exportGroup = client.blockExports().get(exportGroupID);
List<Volume> volumes = Lists.newArrayList();
for (ExportBlockParam exportBlockParam : exportGroup.getVolumes()) {
if (ResourceType.isType(VOLUME, exportBlockParam.getId())) {
volumes.add(new Volume(client.blockVolumes().get(exportBlockParam.getId()), exportBlockParam));
}
}
return volumes;
}
use of com.emc.storageos.model.block.export.ExportBlockParam in project coprhd-controller by CoprHD.
the class BlockProvider method getExportedBlockContinuousCopyByVolume.
@Asset("exportedBlockContinuousCopy")
@AssetDependencies({ "project", "volumeWithContinuousCopies" })
public List<AssetOption> getExportedBlockContinuousCopyByVolume(AssetOptionsContext ctx, URI project, URI volume) {
debug("getting exported blockContinuousCopy (project=%s) (parent=%s)", project, volume);
final ViPRCoreClient client = api(ctx);
Set<URI> exportedMirrors = new HashSet<URI>();
for (ExportGroupRestRep export : client.blockExports().findByProject(project)) {
for (ExportBlockParam resource : export.getVolumes()) {
if (ResourceType.isType(ResourceType.BLOCK_CONTINUOUS_COPY, resource.getId())) {
exportedMirrors.add(resource.getId());
}
}
}
ExportedBlockResourceFilter<BlockMirrorRestRep> exportedMirrorFilter = new ExportedBlockResourceFilter<BlockMirrorRestRep>(exportedMirrors);
List<BlockMirrorRestRep> mirrors = client.blockVolumes().getContinuousCopies(volume, exportedMirrorFilter);
return createVolumeOptions(client, mirrors);
}
use of com.emc.storageos.model.block.export.ExportBlockParam in project coprhd-controller by CoprHD.
the class BlockProvider method getExportedVolumeIds.
/**
* Return a list of all exported volume ids for a given project id.
*
* @param ctx asset option content
* @param project id
* @return list of exported volume ids
*/
private List<URI> getExportedVolumeIds(AssetOptionsContext ctx, URI project) {
final ViPRCoreClient client = api(ctx);
List<URI> volumeIds = Lists.newArrayList();
for (ExportGroupRestRep export : client.blockExports().findByProject(project)) {
for (ExportBlockParam resource : export.getVolumes()) {
if (ResourceType.isType(ResourceType.VOLUME, resource.getId())) {
volumeIds.add(resource.getId());
}
}
}
return volumeIds;
}
use of com.emc.storageos.model.block.export.ExportBlockParam in project coprhd-controller by CoprHD.
the class BlockProvider method getExportedBlockSnapshotsByVolume.
@Asset("exportedBlockSnapshot")
@AssetDependencies({ "project" })
public List<AssetOption> getExportedBlockSnapshotsByVolume(AssetOptionsContext ctx, URI project) {
debug("getting exported blockSnapshots (project=%s)", project);
final ViPRCoreClient client = api(ctx);
List<URI> snapshotIds = Lists.newArrayList();
for (ExportGroupRestRep export : client.blockExports().findByProject(project)) {
for (ExportBlockParam resource : export.getVolumes()) {
if (ResourceType.isType(ResourceType.BLOCK_SNAPSHOT, resource.getId())) {
snapshotIds.add(resource.getId());
}
}
}
List<BlockSnapshotRestRep> snapshots = client.blockSnapshots().getByIds(snapshotIds);
return createVolumeWithVarrayOptions(client, snapshots);
}
use of com.emc.storageos.model.block.export.ExportBlockParam 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;
}
Aggregations