use of com.emc.storageos.model.block.BlockMirrorRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method constructCopiesOptions.
protected List<AssetOption> constructCopiesOptions(ViPRCoreClient client, URI project, List<BlockMirrorRestRep> copies) {
List<AssetOption> options = Lists.newArrayList();
for (BlockMirrorRestRep copy : copies) {
options.add(new AssetOption(copy.getId(), getBlockObjectLabel(client, copy, null)));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.block.BlockMirrorRestRep 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.BlockMirrorRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getExportContinousCopyForHostPortGroups.
@Asset("exportContinousCopyForHostPortGroups")
@AssetDependencies({ "volumeWithContinuousCopies", "unassignedBlockContinuousCopies", "host", "project" })
public List<AssetOption> getExportContinousCopyForHostPortGroups(AssetOptionsContext ctx, URI volumeId, String selectedCopies, URI hostOrClusterId, URI projectId) {
final ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
SimpleValueRep value = client.customConfigs().getCustomConfigTypeValue(VMAX_PORT_GROUP_ENABLED, VMAX);
if (value.getValue().equalsIgnoreCase("true")) {
List<URI> snapshotIds = Lists.newArrayList();
info("Continous Copies selected by user: %s", selectedCopies);
List<String> parsedCopiesIds = TextUtils.parseCSV(selectedCopies);
for (String id : parsedCopiesIds) {
snapshotIds.add(uri(id));
}
List<BlockMirrorRestRep> copies = client.blockVolumes().getContinuousCopies(volumeId);
Set<URI> virtualArrays = new HashSet<URI>();
Set<URI> storageSystems = new HashSet<URI>();
Set<URI> virtualPools = new HashSet<URI>();
for (BlockMirrorRestRep copy : copies) {
virtualArrays.add(copy.getVirtualArray().getId());
storageSystems.add(copy.getStorageController());
virtualPools.add(copy.getVirtualPool().getId());
}
if (virtualArrays.size() == 1 && storageSystems.size() == 1 && virtualPools.size() == 1) {
Iterator<URI> it = virtualArrays.iterator();
URI varrayId = it.next();
ExportGroupRestRep export = findExportGroup(hostOrClusterId, projectId, varrayId, client);
Iterator<URI> ssIt = storageSystems.iterator();
Iterator<URI> vpIt = virtualPools.iterator();
StoragePortGroupRestRepList portGroups = client.varrays().getStoragePortGroups(varrayId, export != null ? export.getId() : null, ssIt.next(), vpIt.next(), null, true);
return createPortGroupOptions(portGroups.getStoragePortGroups());
}
}
return options;
}
use of com.emc.storageos.model.block.BlockMirrorRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getContinuousCopyOptionsForProject.
private List<AssetOption> getContinuousCopyOptionsForProject(AssetOptionsContext ctx, URI project, URI volumeId, ResourceFilter<BlockMirrorRestRep> filter) {
ViPRCoreClient client = api(ctx);
List<BlockMirrorRestRep> copies = client.blockVolumes().getContinuousCopies(volumeId, filter);
return constructCopiesOptions(client, project, copies);
}
Aggregations