use of com.emc.storageos.model.block.export.ExportGroupRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getExportPathVirtualArray.
@Asset("exportPathVirtualArray")
@AssetDependencies({ "exportPathExport", "exportPathStorageSystem" })
public List<AssetOption> getExportPathVirtualArray(AssetOptionsContext ctx, URI exportId, URI storageSystemId) {
ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
ExportGroupRestRep export = client.blockExports().get(exportId);
List<URI> vArrayIds = new ArrayList<URI>();
vArrayIds.add(export.getVirtualArray().getId());
List<StringHashMapEntry> altArrays = export.getAltVirtualArrays() != null ? export.getAltVirtualArrays() : new ArrayList<StringHashMapEntry>();
for (StringHashMapEntry altArray : altArrays) {
if (altArray.getName().equalsIgnoreCase(storageSystemId.toString())) {
vArrayIds.add(URI.create(altArray.getValue()));
}
}
List<VirtualArrayRestRep> vArrays = client.varrays().getByIds(vArrayIds);
for (VirtualArrayRestRep vArray : vArrays) {
options.add(new AssetOption(vArray.getId(), vArray.getName()));
}
return options;
}
use of com.emc.storageos.model.block.export.ExportGroupRestRep 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.ExportGroupRestRep 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.block.export.ExportGroupRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getExportVolumeForHostPortGroups.
@Asset("exportVolumeForHostPortGroups")
@AssetDependencies({ "virtualArray", "blockVirtualPool", "host", "project" })
public List<AssetOption> getExportVolumeForHostPortGroups(AssetOptionsContext ctx, URI vArrayId, URI vpoolId, 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")) {
ExportGroupRestRep export = findExportGroup(hostOrClusterId, projectId, vArrayId, client);
StoragePortGroupRestRepList portGroups = client.varrays().getStoragePortGroups(vArrayId, (export != null ? export.getId() : null), null, vpoolId, null, true);
return createPortGroupOptions(portGroups.getStoragePortGroups());
}
return options;
}
use of com.emc.storageos.model.block.export.ExportGroupRestRep 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;
}
Aggregations