use of com.emc.storageos.model.protection.ProtectionSetRestRep in project coprhd-controller by CoprHD.
the class ProtectionMapper method map.
public static ProtectionSetRestRep map(ProtectionSet from) {
if (from == null) {
return null;
}
ProtectionSetRestRep to = new ProtectionSetRestRep();
mapDataObjectFields(from, to);
to.setProtectionSystem(toRelatedResource(ResourceTypeEnum.PROTECTION_SYSTEM, from.getProtectionSystem()));
to.setProtectionId(from.getProtectionId());
if (from.getVolumes() != null) {
for (String volume : from.getVolumes()) {
to.getVolumes().add(toRelatedResource(ResourceTypeEnum.VOLUME, URI.create(volume)));
}
}
to.setProtectionStatus(from.getProtectionStatus());
to.setProject(toRelatedResource(ResourceTypeEnum.PROJECT, from.getProject()));
to.setNativeGuid(from.getNativeGuid());
return to;
}
use of com.emc.storageos.model.protection.ProtectionSetRestRep 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.protection.ProtectionSetRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getRpFailoverTargets.
protected List<AssetOption> getRpFailoverTargets(ViPRCoreClient client, VolumeRestRep volume) {
Map<String, String> targetVolumes = Maps.newLinkedHashMap();
URI protectionSetId = volume.getProtection().getRpRep().getProtectionSet().getId();
ProtectionSetRestRep localProtectionSet = client.blockVolumes().getProtectionSet(volume.getId(), protectionSetId);
String sourceSiteName = volume.getProtection().getRpRep().getInternalSiteName();
CachedResources<VirtualArrayRestRep> virtualArrays = new CachedResources<VirtualArrayRestRep>(client.varrays());
List<RelatedResourceRep> rpTargets = localProtectionSet.getVolumes();
for (VolumeRestRep protectionSetVolume : client.blockVolumes().getByRefs(rpTargets, RecoverPointPersonalityFilter.TARGET)) {
String targetSiteName = protectionSetVolume.getProtection().getRpRep().getInternalSiteName();
boolean isLocal = StringUtils.equals(sourceSiteName, targetSiteName);
String rpType = isLocal ? "local" : "remote";
VirtualArrayRestRep virtualArray = virtualArrays.get(protectionSetVolume.getVirtualArray());
String label = getMessage("recoverpoint.target", name(protectionSetVolume), rpType, name(virtualArray));
targetVolumes.put(stringId(protectionSetVolume), 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;
}
Aggregations