use of com.emc.storageos.model.vpool.VirtualPoolProtectionRPChanges in project coprhd-controller by CoprHD.
the class PlacementPolicyValidator method validateProtection.
/**
* Validates protection
* Array affinity policy cannot be used for VPool with RP or remote copies
*
* @param protectionParam BlockVirtualPoolProtectionUpdateParam
* @param vPool Virtual Pool (null for creating new virtual pool, or validating current value is not necessary)
*/
private void validateProtection(BlockVirtualPoolProtectionUpdateParam protectionParam, VirtualPool vPool) {
if (protectionParam != null) {
VirtualPoolProtectionRPChanges rpChanges = protectionParam.getRecoverPoint();
if (rpChanges != null) {
if ((rpChanges.getAdd() != null && !rpChanges.getAdd().isEmpty()) || (rpChanges.getRemove() != null && !rpChanges.getRemove().isEmpty()) || rpChanges.getSourcePolicy() != null) {
throw APIException.badRequests.arrayAffinityPlacementPolicyNotAllowedForRPOrRemoteCopies();
}
}
VirtualPoolRemoteProtectionUpdateParam remoteCopies = protectionParam.getRemoteCopies();
if (remoteCopies != null) {
if ((remoteCopies.getAdd() != null && !remoteCopies.getAdd().isEmpty()) || (remoteCopies.getRemove() != null && !remoteCopies.getRemove().isEmpty())) {
throw APIException.badRequests.arrayAffinityPlacementPolicyNotAllowedForRPOrRemoteCopies();
}
}
} else if (vPool != null) {
if (VirtualPool.vPoolSpecifiesProtection(vPool) || VirtualPool.vPoolSpecifiesSRDF(vPool)) {
throw APIException.badRequests.arrayAffinityPlacementPolicyNotAllowedForRPOrRemoteCopies();
}
}
}
use of com.emc.storageos.model.vpool.VirtualPoolProtectionRPChanges in project coprhd-controller by CoprHD.
the class ProtectionValidator method validateJournalSizes.
/**
* Validation of journal sizes and other protection parameters, if they exist.
*
* @param virtualPool
* @param updateParam
* @param dbClient
*/
private void validateJournalSizes(VirtualPool virtualPool, BlockVirtualPoolUpdateParam updateParam, DbClient dbClient) {
Map<String, Object> protection = getProtectionUpdateParameters(updateParam);
Map<String, Object> enabledProtections = filterEntries(protection, and(paramEntryValueNotNull(), paramEntryValueNotNone()));
_logger.info("Requested VirtualPool protections: {}", enabledProtections);
if (enabledProtections.get(PROTECTION_RP) != null) {
VirtualPoolProtectionRPChanges rp = (VirtualPoolProtectionRPChanges) enabledProtections.get(PROTECTION_RP);
if (rp != null) {
// must be specified in the update request.
if (VirtualPool.vPoolSpecifiesProtection(virtualPool) || (rp.getAdd() != null && !rp.getAdd().isEmpty())) {
validateSourcePolicy(rp.getSourcePolicy());
if (rp.getAdd() != null) {
validateProtectionCopies(rp.getAdd(), dbClient);
}
} else if (rp.getSourcePolicy() != null && rp.getSourcePolicy().getJournalSize() != null) {
throwServicePolicyNoProtectionException();
}
}
}
}
use of com.emc.storageos.model.vpool.VirtualPoolProtectionRPChanges in project coprhd-controller by CoprHD.
the class BlockVirtualPoolUpdateBuilder method disableRecoverPoint.
public BlockVirtualPoolUpdateBuilder disableRecoverPoint() {
getProtection().setRecoverPoint(new VirtualPoolProtectionRPChanges());
Set<VirtualPoolProtectionVirtualArraySettingsParam> noCopies = Sets.newHashSet();
setRecoverPointCopies(noCopies);
return this;
}
use of com.emc.storageos.model.vpool.VirtualPoolProtectionRPChanges in project coprhd-controller by CoprHD.
the class ProtectionValidator method validateRpNonHaCopyVpools.
private void validateRpNonHaCopyVpools(BlockVirtualPoolUpdateParam updateParam, DbClient dbClient) {
if (updateParam.getProtection() != null && updateParam.getProtection().specifiesRPProtection() && !updateParam.specifiesHighAvailability()) {
// validate the copy target vpools
BlockVirtualPoolProtectionUpdateParam protection = updateParam.getProtection();
VirtualPoolProtectionRPChanges rpParam = protection.getRecoverPoint();
if (rpParam != null) {
for (VirtualPoolProtectionVirtualArraySettingsParam protectionSettings : rpParam.getAdd()) {
if (protectionSettings.getVpool() != null) {
VirtualPool protectionVirtualPool = dbClient.queryObject(VirtualPool.class, protectionSettings.getVpool());
if (VirtualPool.vPoolSpecifiesHighAvailability(protectionVirtualPool)) {
// does not specify HA.
throw APIException.badRequests.nonVirtualToVirtualProtectionNotSupported();
}
}
}
}
}
}
Aggregations