use of com.emc.storageos.model.block.BlockConsistencyGroupRestRep in project coprhd-controller by CoprHD.
the class ConsistencyGroupsDataTable method fetch.
public static List<ConsistencyGroup> fetch(URI projectId) {
if (projectId == null) {
return Collections.EMPTY_LIST;
}
ViPRCoreClient client = getViprClient();
List<BlockConsistencyGroupRestRep> blockConsistencyGroups = client.blockConsistencyGroups().findByProject(projectId);
List<ConsistencyGroup> results = Lists.newArrayList();
for (BlockConsistencyGroupRestRep blockConsistencyGroup : blockConsistencyGroups) {
results.add(new ConsistencyGroup(blockConsistencyGroup));
}
return results;
}
use of com.emc.storageos.model.block.BlockConsistencyGroupRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getVolumesWithFullCopies.
@Asset("volumeWithFullCopies")
@AssetDependencies({ "project", "blockVolumeOrConsistencyType" })
public List<AssetOption> getVolumesWithFullCopies(AssetOptionsContext ctx, URI project, String volumeOrConsistencyType) {
final ViPRCoreClient client = api(ctx);
if (isVolumeType(volumeOrConsistencyType)) {
List<VolumeRestRep> volumes = findVolumesByProject(client, project);
List<VolumeRestRep> filteredVols = new ArrayList<>();
for (VolumeRestRep vol : volumes) {
if (vol.getProtection() == null || vol.getProtection().getFullCopyRep() == null || vol.getProtection().getFullCopyRep().getFullCopyVolumes() == null || vol.getProtection().getFullCopyRep().getFullCopyVolumes().isEmpty() || !StringUtils.isEmpty(vol.getReplicationGroupInstance())) {
continue;
}
filteredVols.add(vol);
}
log.info("Got volumes with full copies: [{}]", filteredVols.size());
return createVolumeOptions(client, filteredVols);
} else {
List<BlockConsistencyGroupRestRep> consistencyGroups = api(ctx).blockConsistencyGroups().search().byProject(project).run();
return createBaseResourceOptions(consistencyGroups);
}
}
use of com.emc.storageos.model.block.BlockConsistencyGroupRestRep 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.BlockConsistencyGroupRestRep 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.BlockConsistencyGroupRestRep 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);
}
}
Aggregations