use of com.emc.sa.asset.annotation.Asset in project coprhd-controller by CoprHD.
the class BlockProvider method getExportPathExports.
@Asset("exportPathExport")
@AssetDependencies({ "project", "host" })
public List<AssetOption> getExportPathExports(AssetOptionsContext ctx, URI projectId, URI hostOrClusterId) {
ViPRCoreClient client = api(ctx);
List<ExportGroupRestRep> exports = findExportGroups(hostOrClusterId, projectId, null, client);
return createExportWithVarrayOptions(client, exports);
}
use of com.emc.sa.asset.annotation.Asset in project coprhd-controller by CoprHD.
the class BlockProvider method getResultingPaths.
@Asset("exportPathResultingPaths")
@AssetDependencies({ "host", "exportPathVirtualArray", "exportPathExport", "exportPathMinPathsOptions", "exportPathMaxPathsOptions", "exportPathPathsPerInitiatorOptions", "exportPathExistingPath", "exportPathStorageSystem", "exportPathPorts" })
public List<AssetOption> getResultingPaths(AssetOptionsContext ctx, URI hostOrClusterId, URI vArrayId, URI exportId, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, String useExisting, URI storageSystemId, String ports) {
List<URI> exportPathPorts = parseExportPathPorts(ports);
ExportPathsAdjustmentPreviewRestRep portPreview = generateExportPathPreview(ctx, hostOrClusterId, vArrayId, exportId, minPaths, maxPaths, pathsPerInitiator, useExisting, storageSystemId, exportPathPorts);
List<InitiatorPortMapRestRep> addedList = portPreview.getAdjustedPaths();
return buildPathOptions(ctx, addedList, "exportPathAdjustment.resultingPaths");
}
use of com.emc.sa.asset.annotation.Asset in project coprhd-controller by CoprHD.
the class BlockProvider method getRemovedPaths.
@Asset("exportPathRemovedPaths")
@AssetDependencies({ "host", "exportPathVirtualArray", "exportPathExport", "exportPathMinPathsOptions", "exportPathMaxPathsOptions", "exportPathPathsPerInitiatorOptions", "exportPathExistingPath", "exportPathStorageSystem", "exportPathPorts" })
public List<AssetOption> getRemovedPaths(AssetOptionsContext ctx, URI hostOrClusterId, URI vArrayId, URI exportId, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, String useExisting, URI storageSystemId, String ports) {
List<URI> exportPathPorts = parseExportPathPorts(ports);
ExportPathsAdjustmentPreviewRestRep portPreview = generateExportPathPreview(ctx, hostOrClusterId, vArrayId, exportId, minPaths, maxPaths, pathsPerInitiator, useExisting, storageSystemId, exportPathPorts);
List<InitiatorPortMapRestRep> removedList = portPreview.getRemovedPaths();
return buildPathOptions(ctx, removedList, "exportPathAdjustment.removedPaths");
}
use of com.emc.sa.asset.annotation.Asset in project coprhd-controller by CoprHD.
the class BlockProvider method getVolumesByType.
@Asset("blockVolumeByType")
@AssetDependencies({ "project", "blockVolumeOrConsistencyType" })
public List<AssetOption> getVolumesByType(AssetOptionsContext ctx, URI project, String type) {
debug("getting volumes (project=%s)", project);
final ViPRCoreClient client = api(ctx);
if (isVolumeType(type)) {
return createVolumeOptions(client, listVolumesWithoutConsistencyGroup(client, project));
} else {
List<BlockConsistencyGroupRestRep> consistencyGroups = api(ctx).blockConsistencyGroups().search().byProject(project).run();
return createBaseResourceOptions(consistencyGroups);
}
}
use of com.emc.sa.asset.annotation.Asset in project coprhd-controller by CoprHD.
the class BlockProvider method getApplicationSourceVolumes.
@Asset("sourceBlockVolumeForAddToApplication")
@AssetDependencies({ "consistencyGroupAll" })
public List<AssetOption> getApplicationSourceVolumes(AssetOptionsContext ctx, URI cg) {
final ViPRCoreClient client = api(ctx);
VolumeGroupList applications = client.application().getApplications();
List<URI> applicationIds = new ArrayList<URI>();
for (NamedRelatedResourceRep volumeGroup : applications.getVolumeGroups()) {
VolumeGroupRestRep vg = client.application().getApplication(volumeGroup.getId());
if (vg.getRoles().contains("COPY")) {
applicationIds.add(volumeGroup.getId());
}
}
ResourceFilter<VolumeRestRep> cgFilter = new BlockVolumeConsistencyGroupFilter(cg, false);
List<ProjectRestRep> projects = api(ctx).projects().getByTenant(ctx.getTenant());
List<VolumeRestRep> volumes = new ArrayList<VolumeRestRep>();
for (ProjectRestRep project : projects) {
volumes.addAll(listSourceVolumes(api(ctx), project.getId(), cgFilter));
}
List<VolumeRestRep> volumesNotInApplication = new ArrayList<VolumeRestRep>();
for (VolumeRestRep volume : volumes) {
if (volume.getVolumeGroups() != null && !volume.getVolumeGroups().isEmpty()) {
boolean volumeIsInApplication = false;
for (RelatedResourceRep rep : volume.getVolumeGroups()) {
if (applicationIds.contains(rep.getId())) {
volumeIsInApplication = true;
break;
}
}
if (!volumeIsInApplication) {
volumesNotInApplication.add(volume);
}
} else {
volumesNotInApplication.add(volume);
}
}
return createVolumeOptions(null, volumesNotInApplication);
}
Aggregations