public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* rgmanager: master - rgmanager: Allow exit while waiting for cman
@ 2009-03-31 18:38 Lon Hohberger
0 siblings, 0 replies; only message in thread
From: Lon Hohberger @ 2009-03-31 18:38 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/rgmanager.git?p=rgmanager.git;a=commitdiff;h=9f0219f095e2f21f6935b6f3ac0e645e6cdb37a9
Commit: 9f0219f095e2f21f6935b6f3ac0e645e6cdb37a9
Parent: 70b90cab714e51c2ca1e4f59dc85120d902fda01
Author: Lon Hohberger <lhh@redhat.com>
AuthorDate: Mon Mar 30 17:01:45 2009 -0400
Committer: Lon Hohberger <lhh@redhat.com>
CommitterDate: Tue Mar 31 14:37:09 2009 -0400
rgmanager: Allow exit while waiting for cman
If cman isn't running, you can now kill rgmanager
with SIGINT (e.g. ctrl-C) or SIGTERM to make it
quit before initialization is complete.
Signed-off-by: Lon Hohberger <lhh@redhat.com>
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
rgmanager/src/daemons/main.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index 7fc322c..9823111 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -894,8 +894,8 @@ configure_rgmanager(int ccsfd, int dbg)
}
-void
-clu_initialize(cman_handle_t *ch)
+int
+cman_connect(cman_handle_t *ch)
{
if (!ch)
exit(1);
@@ -906,6 +906,8 @@ clu_initialize(cman_handle_t *ch)
while (!(*ch = cman_init(NULL))) {
sleep(1);
+ if (shutdown_pending)
+ return 1;
}
}
@@ -920,10 +922,13 @@ clu_initialize(cman_handle_t *ch)
while (cman_is_quorate(*ch) == 0) {
sleep(1);
+ if (shutdown_pending)
+ return 1;
}
logt_print(LOG_NOTICE, "Quorum formed\n");
}
+ return 0;
}
@@ -1022,7 +1027,9 @@ main(int argc, char **argv)
}
init_logging(NULL, foreground, (debug? LOG_DEBUG : SYSLOGLEVEL));
- clu_initialize(&clu);
+ if (cman_connect(&clu) != 0)
+ goto out; /* Clean exit if sigint/sigterm here */
+
if (cman_init_subsys(clu) < 0) {
perror("cman_init_subsys");
return -1;
@@ -1118,8 +1125,10 @@ main(int argc, char **argv)
if (rg_initialized())
cleanup(cluster_ctx);
- logt_print(LOG_NOTICE, "Shutdown complete, exiting\n");
clu_lock_finished(rgmanager_lsname);
+
+out:
+ logt_print(LOG_NOTICE, "Shutdown complete, exiting\n");
cman_finish(clu);
close_logging();
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-03-31 18:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-31 18:38 rgmanager: master - rgmanager: Allow exit while waiting for cman Lon Hohberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).