use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class BlockProvider method getVplexSnapshotVolumes.
@Asset("vplexVolumeWithSnapshots")
@AssetDependencies({ "project", "blockVolumeOrConsistencyType" })
public List<AssetOption> getVplexSnapshotVolumes(AssetOptionsContext ctx, URI project, String volumeOrConsistencyType) {
final ViPRCoreClient client = api(ctx);
if (isVolumeType(volumeOrConsistencyType)) {
Set<URI> volIdSet = new HashSet<>();
List<BlockSnapshotRestRep> snapshots = findSnapshotsByProject(client, project);
for (BlockSnapshotRestRep s : snapshots) {
volIdSet.add(s.getParent().getId());
}
// Have to get volumes just as it needs vol's mount point which snapshot doesn't have.
List<VolumeRestRep> volumes = getVolumesByIds(client, volIdSet);
List<VolumeRestRep> filteredVols = new ArrayList<>();
for (VolumeRestRep vol : volumes) {
if (vol.getHaVolumes() != null && !vol.getHaVolumes().isEmpty() && !isInConsistencyGroup(vol)) {
filteredVols.add(vol);
}
}
return createVolumeOptions(client, filteredVols);
} else {
List<BlockConsistencyGroupRestRep> consistencyGroups = client.blockConsistencyGroups().findByProject(project, new DefaultResourceFilter<BlockConsistencyGroupRestRep>() {
@Override
public boolean accept(BlockConsistencyGroupRestRep cg) {
if (cg.getTypes() != null && cg.getTypes().contains(Types.VPLEX.name())) {
return true;
} else {
return false;
}
}
});
return createBaseResourceOptions(consistencyGroups);
}
}
use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class BlockProvider method getLinkedSnapshotsForApplicationSnapshotSessionVolumeNew.
@Asset("linkedSnapshotsForApplicationSnapshotSessionLinkService")
@AssetDependencies({ "application", "applicationSnapshotSessionCopySets" })
public List<AssetOption> getLinkedSnapshotsForApplicationSnapshotSessionVolumeNew(AssetOptionsContext ctx, URI application, String selectedCopySet) {
ViPRCoreClient client = api(ctx);
List<BlockSnapshotRestRep> snapshots = new ArrayList<BlockSnapshotRestRep>();
Set<String> replicationGroups = getReplicationGroupsForApplicationSnapshotSession(client, application, selectedCopySet);
Set<String> copySets = client.application().getVolumeGroupSnapsetSessionSets(application).getCopySets();
List<BlockSnapshotSessionRestRep> snapshotSessions = Lists.newArrayList();
for (String copySet : copySets) {
VolumeGroupCopySetParam param = new VolumeGroupCopySetParam();
param.setCopySetName(copySet);
BlockSnapshotSessionList snapshotSessionList = client.application().getVolumeGroupSnapshotSessionsByCopySet(application, param);
List<BlockSnapshotSessionRestRep> snapshotSessionsTmp = client.blockSnapshotSessions().getByRefs(snapshotSessionList.getSnapSessionRelatedResourceList());
snapshotSessions.addAll(snapshotSessionsTmp);
for (BlockSnapshotSessionRestRep session : snapshotSessionsTmp) {
if (replicationGroups.contains(BlockStorageUtils.stripRPTargetFromReplicationGroup(session.getReplicationGroupInstance()))) {
for (RelatedResourceRep target : session.getLinkedTarget()) {
BlockSnapshotRestRep blockSnapshot = client.blockSnapshots().get(target);
snapshots.add(blockSnapshot);
}
}
}
}
return constructSnapshotWithSnapshotSessionOptions(snapshots, snapshotSessions);
}
use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class BlockProvider method getApplications.
@Asset("application")
public List<AssetOption> getApplications(AssetOptionsContext ctx) {
final ViPRCoreClient client = api(ctx);
List<VolumeGroupRestRep> volumeGroups = client.application().getApplications(new DefaultResourceFilter<VolumeGroupRestRep>() {
@Override
public boolean accept(VolumeGroupRestRep volumeGroup) {
if (volumeGroup.getRoles() != null && volumeGroup.getRoles().contains(VolumeGroup.VolumeGroupRole.COPY.name())) {
return true;
} else {
return false;
}
}
});
return createBaseResourceOptions(volumeGroups);
}
use of com.emc.vipr.client.ViPRCoreClient 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.vipr.client.ViPRCoreClient 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);
}
}
Aggregations