public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: Lon Hohberger <lon@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: rgmanager: master - rgmanager: Allow exit while waiting for cman Date: Tue, 31 Mar 2009 18:38:00 -0000 [thread overview] Message-ID: <20090331183756.F3E41120197@lists.fedorahosted.org> (raw) 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();
reply other threads:[~2009-03-31 18:38 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090331183756.F3E41120197@lists.fedorahosted.org \ --to=lon@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).