use of com.emc.storageos.model.block.BlockConsistencyGroupRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getSnapshotSessionBlockVolumes.
@Asset("snapshotSessionBlockVolume")
@AssetDependencies({ "project", "blockVolumeOrConsistencyType" })
public List<AssetOption> getSnapshotSessionBlockVolumes(AssetOptionsContext context, URI project, String storageType) {
final ViPRCoreClient client = api(context);
if (isVolumeType(storageType)) {
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) {
boolean localSnapSupported = isLocalSnapshotSupported(detail.vpool);
boolean isRPTargetVolume = isRPTargetVolume(detail.volume);
boolean isRPSourceVolume = isRPSourceVolume(detail.volume);
boolean isInConsistencyGroup = !StringUtils.isEmpty(detail.volume.getReplicationGroupInstance());
boolean isSnapshotSessionSupported = isSnapshotSessionSupportedForVolume(detail.volume);
debug("filter[ localSnapSupported=%s, isRPTargetVolume=%s, isRPSourceVolume=%s, isInConsistencyGroup=%s, isXio3XVolume=%s ]", localSnapSupported, isRPTargetVolume, isRPSourceVolume, isInConsistencyGroup, isSnapshotSessionSupported);
if (isSnapshotSessionSupported && localSnapSupported && !isInConsistencyGroup) {
options.add(createVolumeOption(client, null, detail.volume, volumeNames));
}
}
return options;
} 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 getFailoverTarget.
@Asset("failoverTarget")
@AssetDependencies("protectedBlockVolume")
public List<AssetOption> getFailoverTarget(AssetOptionsContext ctx, URI protectedBlockVolume) {
if (protectedBlockVolume != null) {
ViPRCoreClient client = api(ctx);
if (BlockProviderUtils.isType(protectedBlockVolume, VOLUME_TYPE)) {
debug("getting failoverTargets (protectedBlockVolume=%s)", protectedBlockVolume);
VolumeRestRep volume = client.blockVolumes().get(protectedBlockVolume);
ProtectionRestRep protection = volume.getProtection();
if (protection != null) {
// RecoverPoint protection
if (protection.getRpRep() != null && protection.getRpRep().getProtectionSet() != null) {
return getRpFailoverTargets(client, volume);
}
// VMAX SRDF protection
if (protection.getSrdfRep() != null && protection.getSrdfRep().getSRDFTargetVolumes() != null && !protection.getSrdfRep().getSRDFTargetVolumes().isEmpty()) {
return getSrdfFailoverTargets(client, volume);
}
}
} else if (BlockProviderUtils.isType(protectedBlockVolume, BLOCK_CONSISTENCY_GROUP_TYPE)) {
debug("getting failoverTargets for consistency group %s", protectedBlockVolume);
BlockConsistencyGroupRestRep cg = client.blockConsistencyGroups().get(protectedBlockVolume);
List<VolumeRestRep> srcVolumes = null;
// Get RP source volumes
if (cg.getTypes().contains(BlockConsistencyGroup.Types.RP.name())) {
srcVolumes = client.blockVolumes().getByRefs(cg.getVolumes(), RecoverPointPersonalityFilter.SOURCE);
}
// Get SRDF source volumes
if (cg.getTypes().contains(BlockConsistencyGroup.Types.SRDF.name())) {
srcVolumes = client.blockVolumes().getByRefs(cg.getVolumes(), new SRDFSourceFilter());
}
if (srcVolumes != null && !srcVolumes.isEmpty()) {
// Get the first source volume and obtain its target references
VolumeRestRep srcVolume = srcVolumes.get(0);
if (cg.getTypes() != null) {
Map<String, String> targetVolumes = Maps.newLinkedHashMap();
CachedResources<VirtualArrayRestRep> virtualArrays = new CachedResources<VirtualArrayRestRep>(client.varrays());
List<VirtualArrayRelatedResourceRep> targets = new ArrayList<VirtualArrayRelatedResourceRep>();
// Process the RP targets
if (cg.getTypes().contains(BlockConsistencyGroup.Types.RP.name())) {
targets = srcVolume.getProtection().getRpRep().getRpTargets();
}
// Process the SRDF targets
if (cg.getTypes().contains(BlockConsistencyGroup.Types.SRDF.name())) {
targets = srcVolume.getProtection().getSrdfRep().getSRDFTargetVolumes();
}
for (VolumeRestRep targetVolume : client.blockVolumes().getByRefs(targets)) {
VirtualArrayRestRep virtualArray = virtualArrays.get(targetVolume.getVirtualArray());
String label = getMessage(name(virtualArray));
targetVolumes.put(stringId(virtualArray), label);
}
List<AssetOption> options = Lists.newArrayList();
for (Map.Entry<String, String> entry : targetVolumes.entrySet()) {
options.add(new AssetOption(entry.getKey(), entry.getValue()));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
}
}
}
return Lists.newArrayList();
}
use of com.emc.storageos.model.block.BlockConsistencyGroupRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getSnapshotBlockVolumes.
@Asset("snapshotBlockVolume")
@AssetDependencies({ "project", "blockVolumeOrConsistencyType" })
public List<AssetOption> getSnapshotBlockVolumes(AssetOptionsContext context, URI project, String storageType) {
final ViPRCoreClient client = api(context);
if (isVolumeType(storageType)) {
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 (detail.vpool == null) {
continue;
}
boolean localSnapSupported = isLocalSnapshotSupported(detail.vpool);
boolean isRPTargetVolume = isRPTargetVolume(detail.volume);
boolean isRPSourceVolume = isRPSourceVolume(detail.volume);
boolean isInConsistencyGroup = BlockProvider.isInConsistencyGroup(detail.volume);
debug("filter[ localSnapSupported=%s, isRPTargetVolume=%s, isRPSourceVolume=%s, isInConsistencyGroup=%s]", localSnapSupported, isRPTargetVolume, isRPSourceVolume, isInConsistencyGroup);
if (isRPSourceVolume || (localSnapSupported && (!isInConsistencyGroup || isRPTargetVolume))) {
options.add(createVolumeOption(client, null, detail.volume, volumeNames));
}
}
return options;
} 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 ConsistencyGroupProvider method getAllConsistencyGroup.
@Asset("consistencyGroupAll")
public List<AssetOption> getAllConsistencyGroup(AssetOptionsContext ctx) {
List<ProjectRestRep> projects = api(ctx).projects().getByTenant(ctx.getTenant());
List<BlockConsistencyGroupRestRep> cgs = Lists.newArrayList();
for (ProjectRestRep project : projects) {
cgs.addAll(api(ctx).blockConsistencyGroups().findByProject(project));
}
List<AssetOption> options = createBaseResourceOptions(cgs);
return options;
}
use of com.emc.storageos.model.block.BlockConsistencyGroupRestRep in project coprhd-controller by CoprHD.
the class ConsistencyGroupProvider method getConsistencyGroupFilters.
@Asset("consistencyGroupFilter")
public List<AssetOption> getConsistencyGroupFilters(AssetOptionsContext ctx) {
List<ProjectRestRep> projects = api(ctx).projects().getByTenant(ctx.getTenant());
List<BlockConsistencyGroupRestRep> cgs = Lists.newArrayList();
for (ProjectRestRep project : projects) {
cgs.addAll(api(ctx).blockConsistencyGroups().findByProject(project));
}
List<AssetOption> options = createBaseResourceOptions(cgs);
options.add(0, new AssetOption("None", "None"));
return options;
}
Aggregations