ldap/servers/plugins/replication/repl5_agmt.c | 28 ++++++++++++++--------
ldap/servers/plugins/replication/repl5_agmtlist.c | 23 +++++++++++-------
2 files changed, 32 insertions(+), 19 deletions(-)
New commits:
commit db6bcd7801a30abd40c09ea90e8ea7938983762f
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Thu Apr 4 15:18:11 2013 -0400
Ticket 47304 - reinitialization of a master with a disabled agreement hangs
Bug Description: When IPA tries to initialize a disabled agreement, the script hangs
as the attribute nsds5beginReplicaRefresh is not removed, and
always
stays in "start" mode.
Fix Description: Return an error 53, and error text, when trying to initialize a
disabled
agreement. Also improved the logging when an agmt or suffix is
disabled.
https://fedorahosted.org/389/ticket/47304
Reviewed by: richm(Thanks Rich!)
diff --git a/ldap/servers/plugins/replication/repl5_agmt.c
b/ldap/servers/plugins/replication/repl5_agmt.c
index f25b7fb..b7d107e 100644
--- a/ldap/servers/plugins/replication/repl5_agmt.c
+++ b/ldap/servers/plugins/replication/repl5_agmt.c
@@ -2220,16 +2220,24 @@ agmt_set_last_init_status (Repl_Agmt *ra, int ldaprc, int replrc,
const char *me
}
else if (replrc == NSDS50_REPL_DISABLED)
{
- PR_snprintf(ra->last_init_status, STATUS_LEN, "%d Total update aborted:
"
- "Replication agreement for %s\n can not be updated while the replica is
disabled.\n"
- "(If the suffix is disabled you must enable it then restart the server for
replication to take place).",
- replrc, ra->long_name ? ra->long_name : "a replica");
- /* Log into the errors log, as "ra->long_name" is not accessible from
the caller */
- slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
- "Total update aborted: Replication agreement for \"%s\" "
- "can not be updated while the replica is disabled\n", ra->long_name ?
ra->long_name : "a replica");
- slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
- "(If the suffix is disabled you must enable it then restart the server for
replication to take place).\n");
+ if(agmt_is_enabled(ra)){
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "Total update aborted:
"
+ "Replication agreement for \"%s\" can not be updated while the
suffix is disabled.\n"
+ "You must enable it then restart the server for replication to take
place).\n",
+ ra->long_name ? ra->long_name : "a replica");
+ PR_snprintf(ra->last_init_status, STATUS_LEN, "%d Total update aborted:
"
+ "Replication agreement for \"%s\" can not be updated while the
suffix is disabled.\n"
+ "You must enable it then restart the server for replication to take
place).",
+ replrc, ra->long_name ? ra->long_name : "a replica");
+ } else {
+ /* You do not need to restart the server after enabling the agreement */
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "Total update aborted:
"
+ "Replication agreement for \"%s\" can not be updated while the
agreement is disabled\n",
+ ra->long_name ? ra->long_name : "a replica");
+ PR_snprintf(ra->last_init_status, STATUS_LEN, "%d Total update aborted:
"
+ "Replication agreement for \"%s\" can not be updated while the
agreement is disabled.",
+ replrc, ra->long_name ? ra->long_name : "a replica");
+ }
}
else
{
diff --git a/ldap/servers/plugins/replication/repl5_agmtlist.c
b/ldap/servers/plugins/replication/repl5_agmtlist.c
index 70f71a8..1167b0c 100644
--- a/ldap/servers/plugins/replication/repl5_agmtlist.c
+++ b/ldap/servers/plugins/replication/repl5_agmtlist.c
@@ -302,10 +302,8 @@ agmtlist_modify_callback(Slapi_PBlock *pb, Slapi_Entry *entryBefore,
Slapi_Entry
{
PR_snprintf (errortext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid
value (%s) value supplied for attr (%s)",
val, mods[i]->mod_type);
- slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"agmtlist_modify_callback: %s\n",
- errortext);
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"agmtlist_modify_callback: %s\n", errortext);
}
-
slapi_ch_free ((void**)&val);
}
}
@@ -529,15 +527,22 @@ agmtlist_modify_callback(Slapi_PBlock *pb, Slapi_Entry *entryBefore,
Slapi_Entry
}
else if (start_initialize)
{
- if (agmt_initialize_replica(agmt) != 0) {
- /* The suffix is disabled */
- agmt_set_last_init_status(agmt, 0, NSDS50_REPL_DISABLED, NULL);
- }
+ if (agmt_initialize_replica(agmt) != 0) {
+ /* The suffix/repl agmt is disabled */
+ agmt_set_last_init_status(agmt, 0, NSDS50_REPL_DISABLED, NULL);
+ if(agmt_is_enabled(agmt)){
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Suffix is
disabled");
+ } else {
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Replication
agreement is disabled");
+ }
+ *returncode = LDAP_UNWILLING_TO_PERFORM;
+ rc = SLAPI_DSE_CALLBACK_ERROR;
+ }
}
else if (cancel_initialize)
{
- agmt_replica_init_done(agmt);
- }
+ agmt_replica_init_done(agmt);
+ }
if (update_the_schedule)
{