use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getFullCopiesForApplication.
private List<VolumeRestRep> getFullCopiesForApplication(AssetOptionsContext ctx, URI applicationId) {
List<VolumeRestRep> fullCopies = new ArrayList<VolumeRestRep>();
final ViPRCoreClient client = api(ctx);
NamedVolumesList volList = client.application().getFullCopiesByApplication(applicationId);
if (volList != null && volList.getVolumes() != null && !volList.getVolumes().isEmpty()) {
List<URI> ids = new ArrayList<URI>();
for (NamedRelatedResourceRep volId : volList.getVolumes()) {
ids.add(volId.getId());
}
fullCopies.addAll(client.blockVolumes().getByIds(ids));
}
return fullCopies;
}
use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getBlockVolumesWithSnapshot.
@Asset("blockVolumeWithSnapshot")
@AssetDependencies({ "project", "blockVolumeOrConsistencyType" })
public List<AssetOption> getBlockVolumesWithSnapshot(AssetOptionsContext context, URI project, String volumeOrConsistencyType) {
final ViPRCoreClient client = api(context);
if (isVolumeType(volumeOrConsistencyType)) {
Set<URI> volIdSet = new HashSet<>();
List<BlockSnapshotRestRep> snapshots = findSnapshotsByProject(client, project);
for (BlockSnapshotRestRep snapshot : snapshots) {
volIdSet.add(snapshot.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 (StringUtils.isEmpty(vol.getReplicationGroupInstance())) {
filteredVols.add(vol);
}
}
return createVolumeOptions(client, filteredVols);
} else {
List<BlockConsistencyGroupRestRep> consistencyGroups = client.blockConsistencyGroups().search().byProject(project).run();
return createBaseResourceOptions(consistencyGroups);
}
}
use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getRemoteSnapshotBlockVolumes.
@Asset("remoteSnapshotBlockVolume")
@AssetDependencies({ "project" })
public List<AssetOption> getRemoteSnapshotBlockVolumes(AssetOptionsContext context, URI project) {
final ViPRCoreClient client = api(context);
List<VolumeRestRep> volumes = listVolumes(client, project);
List<VolumeDetail> volumeDetails = getVolumeDetails(client, volumes);
Map<URI, VolumeRestRep> volumeNames = ResourceUtils.mapById(volumes);
List<AssetOption> options = Lists.newArrayList();
for (VolumeDetail detail : volumeDetails) {
if (isRemoteSnapshotSupported(detail.volume)) {
options.add(createVolumeOption(client, null, detail.volume, volumeNames));
}
}
return options;
}
use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getBlockJournalSize.
@Asset("blockJournalSize")
@AssetDependencies("rpConsistencyGroupByProject")
public List<AssetOption> getBlockJournalSize(AssetOptionsContext ctx, URI consistencyGroup) {
String minimumSize = null;
BlockConsistencyGroupRestRep cg = api(ctx).blockConsistencyGroups().get(consistencyGroup);
// Get the first volume in the consistency group. All volumes will be source volumes
RelatedResourceRep vol = cg.getVolumes().get(0);
VolumeRestRep volume = api(ctx).blockVolumes().get(vol);
if (volume.getProtection() != null && volume.getProtection().getRpRep() != null && volume.getProtection().getRpRep().getProtectionSet() != null) {
RelatedResourceRep protectionSetId = volume.getProtection().getRpRep().getProtectionSet();
ProtectionSetRestRep protectionSet = api(ctx).blockVolumes().getProtectionSet(volume.getId(), protectionSetId.getId());
List<URI> protectionSetVolumeIds = new ArrayList<URI>();
for (RelatedResourceRep protectionVolume : protectionSet.getVolumes()) {
protectionSetVolumeIds.add(protectionVolume.getId());
}
List<VolumeRestRep> protectionSetVolumes = api(ctx).blockVolumes().withInternal(true).getByIds(protectionSetVolumeIds, null);
for (VolumeRestRep protectionVolume : protectionSetVolumes) {
if (protectionVolume.getProtection().getRpRep().getPersonality().equalsIgnoreCase("METADATA")) {
String capacity = protectionVolume.getCapacity();
if (minimumSize == null || Float.parseFloat(capacity) < Float.parseFloat(minimumSize)) {
minimumSize = capacity;
}
}
}
}
if (minimumSize == null) {
return Lists.newArrayList();
} else {
return Lists.newArrayList(newAssetOption(minimumSize, minimumSize));
}
}
use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getExportedVolumes.
@Asset("exportedBlockVolume")
@AssetDependencies("project")
public List<AssetOption> getExportedVolumes(AssetOptionsContext ctx, URI project) {
debug("getting source block volumes (project=%s)", project);
final ViPRCoreClient client = api(ctx);
// Filter volumes that are not RP Metadata
List<URI> volumeIds = getExportedVolumeIds(ctx, project);
FilterChain<VolumeRestRep> filter = new FilterChain<VolumeRestRep>(RecoverPointPersonalityFilter.METADATA.not());
filter.and(new BlockVolumeVMFSDatastoreFilter().not());
filter.and(new BlockVolumeBootVolumeFilter().not());
filter.and(new BlockVolumeMountPointFilter().not());
List<VolumeRestRep> volumes = client.blockVolumes().getByIds(volumeIds, filter);
return createVolumeWithVarrayOptions(client, volumes);
}
Aggregations