From 7076fd22e744fd51dbcc0c4e4a4089884a3dae48 Mon Sep 17 00:00:00 2001
From: Christian Heimes <cheimes@redhat.com>
Date: Wed, 11 Apr 2018 13:34:41 +0200
Subject: [PATCH] Add nsds5ReplicaReleaseTimeout to replica config
The nsds5ReplicaReleaseTimeout setting prevents the monopolization of
replicas during initial or busy master-master replication. 389-DS
documentation suggets a timeout of 60 seconds to improve convergence of
replicas.
See: http://directory.fedoraproject.org/docs/389ds/design/repl-conv-design.html
Fixes: https://pagure.io/freeipa/issue/7488
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
---
ipaserver/install/replication.py | 21 ++++++++++++++++-----
ipaserver/install/server/upgrade.py | 17 +++++++++++++++++
2 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index 3cd871e5df44398fd994504a3807a5648af5e048..e0055b792ce5b51fd411a7ea1f4316bb017984ba 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/install/replication.py
@@ -468,20 +468,30 @@ class ReplicationManager(object):
try:
entry = conn.get_entry(dn)
+ except errors.NotFound:
+ pass
+ else:
managers = {DN(m) for m in entry.get('nsDS5ReplicaBindDN', [])}
+ mods = []
if replica_binddn not in managers:
# Add the new replication manager
- mod = [(ldap.MOD_ADD, 'nsDS5ReplicaBindDN',
- replica_binddn)]
- conn.modify_s(dn, mod)
+ mods.append(
+ (ldap.MOD_ADD, 'nsDS5ReplicaBindDN', replica_binddn)
+ )
+ if 'nsds5replicareleasetimeout' not in entry:
+ # See https://pagure.io/freeipa/issue/7488
+ mods.append(
+ (ldap.MOD_ADD, 'nsds5replicareleasetimeout', ['60'])
+ )
+
+ if mods:
+ conn.modify_s(dn, mods)
self.set_replica_binddngroup(conn, entry)
# replication is already configured
return
- except errors.NotFound:
- pass
replica_type = self.get_replica_type()
@@ -496,6 +506,7 @@ class ReplicationManager(object):
nsds5replicabinddn=[replica_binddn],
nsds5replicabinddngroup=[self.repl_man_group_dn],
nsds5replicabinddngroupcheckinterval=["60"],
+ nsds5replicareleasetimeout=["60"],
nsds5replicalegacyconsumer=["off"],
)
conn.add_entry(entry)
diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py
index 62665d56ca0fb2c632f8ba135f8b6191a18b6aa1..62a75510ad331923f468c28908ea407789ec380c 100644
--- a/ipaserver/install/server/upgrade.py
+++ b/ipaserver/install/server/upgrade.py
@@ -1565,6 +1565,19 @@ def disable_httpd_system_trust(http):
db.add_cert(cert, nickname, trust_flags)
+def update_replica_config(db_suffix):
+ dn = DN(
+ ('cn', 'replica'), ('cn', db_suffix), ('cn', 'mapping tree'),
+ ('cn', 'config')
+ )
+ entry = api.Backend.ldap2.get_entry(dn)
+ if 'nsds5replicareleasetimeout' not in entry:
+ # See https://pagure.io/freeipa/issue/7488
+ root_logger.info("Adding nsds5replicaReleaseTimeout=60 to %s", dn)
+ entry['nsds5replicareleasetimeout'] = '60'
+ api.Backend.ldap2.update_entry(entry)
+
+
def upgrade_configuration():
"""
Execute configuration upgrade of the IPA services
@@ -1681,6 +1694,10 @@ def upgrade_configuration():
ds.configure_dirsrv_ccache()
+ update_replica_config(ipautil.realm_to_suffix(api.env.realm))
+ if ca.is_configured():
+ update_replica_config(DN(('o', 'ipaca')))
+
ntpinstance.ntp_ldap_enable(api.env.host, api.env.basedn, api.env.realm)
ds.stop(ds_serverid)
--
2.14.3