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: cluster: RHEL5 - rgmanager: Clean up some bits during reconfig Date: Fri, 20 Mar 2009 19:09:00 -0000 [thread overview] Message-ID: <20090320190814.0A12B1202D3@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=c9a1a4f5aad9a135ba135cc713a50ccaa2e4afa1 Commit: c9a1a4f5aad9a135ba135cc713a50ccaa2e4afa1 Parent: 3ae8d22b660dc6e2c778d6157afdb3785ef61a7e Author: Lon Hohberger <lhh@redhat.com> AuthorDate: Wed Mar 18 17:14:52 2009 -0400 Committer: Lon Hohberger <lhh@redhat.com> CommitterDate: Fri Mar 20 15:07:40 2009 -0400 rgmanager: Clean up some bits during reconfig * Ignore additional reconfiguration events after the first for a given config version. * Always ensure we call init_resource_groups with the correct number of parameters. Signed-off-by: Lon Hohberger <lhh@redhat.com> --- rgmanager/include/resgroup.h | 1 + rgmanager/src/daemons/groups.c | 24 +++++++++++++++++++----- rgmanager/src/daemons/main.c | 3 +-- rgmanager/src/daemons/nodeevent.c | 1 - rgmanager/src/daemons/rg_event.c | 10 ++-------- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/rgmanager/include/resgroup.h b/rgmanager/include/resgroup.h index 41eea76..a4b53fe 100644 --- a/rgmanager/include/resgroup.h +++ b/rgmanager/include/resgroup.h @@ -131,6 +131,7 @@ int group_migrate(char *groupname, int target); int rg_status(const char *resgroupname); int group_op(char *rgname, int op); void rg_init(void); +int init_resource_groups(int reconfig, int do_init, int cfg_version); /* Basic service operations */ int svc_start(char *svcName, int req); diff --git a/rgmanager/src/daemons/groups.c b/rgmanager/src/daemons/groups.c index d973e73..2c23cd5 100644 --- a/rgmanager/src/daemons/groups.c +++ b/rgmanager/src/daemons/groups.c @@ -1579,7 +1579,7 @@ do_condstarts(void) int -check_config_update(int *new, int *old) +check_config_update(int *old, int *new) { int newver = 0, fd, ret = 0; char *val = NULL; @@ -1622,7 +1622,7 @@ dump_config_version(FILE *fp) resource group modification. */ int -init_resource_groups(int reconfigure, int do_init) +init_resource_groups(int reconfigure, int do_init, int new_config_version) { int fd, x, y, cnt; @@ -1634,8 +1634,17 @@ init_resource_groups(int reconfigure, int do_init) event_t *evp; char *val; - if (reconfigure) + if (reconfigure) { + x = 0; + pthread_mutex_lock(&config_mutex); + if (new_config_version == config_version) + x = 1; + pthread_mutex_unlock(&config_mutex); + if (x == 1) + return 0; clulog(LOG_NOTICE, "Reconfiguring\n"); + } + clulog(LOG_INFO, "Loading Service Data\n"); clulog(LOG_DEBUG, "Loading Resource Rules\n"); if (load_resource_rules(RESOURCE_ROOTDIR, &rulelist) != 0) { @@ -1708,13 +1717,18 @@ init_resource_groups(int reconfigure, int do_init) cnt += y; } } - clulog(LOG_DEBUG, "%d events defined\n", x); - + clulog(LOG_DEBUG, "%d events defined\n", y); /* Reconfiguration done */ ccs_unlock(fd); + if (reconfigure) { + pthread_mutex_lock(&config_mutex); + clulog(LOG_INFO, "Applying new configuration #%d\n", + config_version); + + pthread_mutex_unlock(&config_mutex); /* Calc tree deltas */ pthread_rwlock_wrlock(&resource_lock); resource_delta(&_resources, &reslist); diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c index cd65c33..6a5a8b4 100644 --- a/rgmanager/src/daemons/main.c +++ b/rgmanager/src/daemons/main.c @@ -50,7 +50,6 @@ int configure_rgmanager(int ccsfd, int debug); void node_event(int, int, int, int); void node_event_q(int, int, int, int); int daemon_init(char *); -int init_resource_groups(int, int); void kill_resource_groups(void); void set_my_id(int); void flag_shutdown(int sig); @@ -1065,7 +1064,7 @@ main(int argc, char **argv) configure_rgmanager(-1, debug); clulog(LOG_NOTICE, "Resource Group Manager Starting\n"); - if (init_resource_groups(0, do_init) != 0) { + if (init_resource_groups(0, do_init, 0) != 0) { clulog(LOG_CRIT, "#8: Couldn't initialize services\n"); return -1; } diff --git a/rgmanager/src/daemons/nodeevent.c b/rgmanager/src/daemons/nodeevent.c index 078dbf3..95418c2 100644 --- a/rgmanager/src/daemons/nodeevent.c +++ b/rgmanager/src/daemons/nodeevent.c @@ -46,7 +46,6 @@ static int transition_throttling = 5; int ne_queue_request(int local, int nodeid, int state); void hard_exit(void); -int init_resource_groups(int); void flag_shutdown(int sig); void flag_reconfigure(int sig); diff --git a/rgmanager/src/daemons/rg_event.c b/rgmanager/src/daemons/rg_event.c index d2c7cd3..9ac9de9 100644 --- a/rgmanager/src/daemons/rg_event.c +++ b/rgmanager/src/daemons/rg_event.c @@ -54,7 +54,6 @@ static int _xid = 0; static event_master_t *mi = NULL; void hard_exit(void); -int init_resource_groups(int); void flag_shutdown(int sig); void flag_reconfigure(int sig); @@ -111,7 +110,7 @@ node_event(int local, int nodeID, int nodeStatus, } if (!rg_initialized()) { - if (init_resource_groups(0) != 0) { + if (init_resource_groups(0, 0, 0) != 0) { clulog(LOG_ERR, "#36: Cannot initialize services\n"); hard_exit(); @@ -424,12 +423,7 @@ _event_thread_f(void __attribute__ ((unused)) *arg) pthread_mutex_unlock(&event_queue_mutex); if (ev->ev_type == EVENT_CONFIG) { - /* - clulog(LOG_NOTICE, "Config Event: %d -> %d\n", - ev->ev.config.cfg_oldversion, - ev->ev.config.cfg_version); - */ - init_resource_groups(1); + init_resource_groups(1, 1, ev->ev.config.cfg_version); free(ev); continue; }
reply other threads:[~2009-03-20 19:09 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=20090320190814.0A12B1202D3@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).