From: lhh@sourceware.org <lhh@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/rgmanager ChangeLog include/resgroup.h ...
Date: 6 Oct 2006 21:22:28 -0000 [thread overview]
Message-ID: <20061006212228.11465.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: lhh at sourceware.org 2006-10-06 21:22:28
Modified files:
rgmanager : ChangeLog
rgmanager/include: resgroup.h
rgmanager/src/daemons: groups.c main.c
rgmanager/src/utils: clustat.c
Log message:
Fix #202497
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/ChangeLog.diff?cvsroot=cluster&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/resgroup.h.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/groups.c.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/main.c.diff?cvsroot=cluster&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/utils/clustat.c.diff?cvsroot=cluster&r1=1.23&r2=1.24
--- cluster/rgmanager/ChangeLog 2006/09/27 18:58:53 1.27
+++ cluster/rgmanager/ChangeLog 2006/10/06 21:22:27 1.28
@@ -1,3 +1,13 @@
+2006-10-06 Lon Hohberger <lhh@redhat.com>
+ * src/daemons/main.c: Fix #202497: provide rgmanager's view of
+ who is running rgmanager to clustat.
+ * src/daemons/groups.c: Fix tiny memory leak during configuration
+ changes
+ * include/resgroup.h: #202497: Flip unused RG_STATUS_INQUIRY to
+ RG_STATUS_NODE.
+ * src/utils/clustat.c: #202497: Send RG_STATUS_NODE to clurgmgrd
+ in order to obtain rgmanager "group" status information
+
2006-09-27 Lon Hohberger <lhh@redhat.com>
* src/daemons/rg_state.c: Fix #208011 - failed->disabled state
transition. Fix node ID type.
--- cluster/rgmanager/include/resgroup.h 2006/09/01 19:02:21 1.14
+++ cluster/rgmanager/include/resgroup.h 2006/10/06 21:22:27 1.15
@@ -68,7 +68,7 @@
#define RG_EXITING 9
#define RG_INIT 10
#define RG_ENABLE 11
-#define RG_STATUS_INQUIRY 12
+#define RG_STATUS_NODE 12
#define RG_RELOCATE 13
#define RG_CONDSTOP 14
#define RG_CONDSTART 15
--- cluster/rgmanager/src/daemons/groups.c 2006/09/27 16:28:41 1.23
+++ cluster/rgmanager/src/daemons/groups.c 2006/10/06 21:22:27 1.24
@@ -1228,6 +1228,7 @@
pthread_mutex_lock(&config_mutex);
config_version = atoi(val);
pthread_mutex_unlock(&config_mutex);
+ free(val);
}
clulog(LOG_DEBUG, "Building Resource Trees\n");
--- cluster/rgmanager/src/daemons/main.c 2006/09/27 16:28:41 1.32
+++ cluster/rgmanager/src/daemons/main.c 2006/10/06 21:22:27 1.33
@@ -87,6 +87,26 @@
void
+send_node_states(msgctx_t *ctx)
+{
+ int x;
+ generic_msg_hdr hdr;
+ cluster_member_list_t *ml = member_list();
+
+ for (x = 0; x < ml->cml_count; x++) {
+ if (ml->cml_members[x].cn_member == 1) {
+ msg_send_simple(ctx, RG_STATUS_NODE,
+ ml->cml_members[x].cn_nodeid, 0);
+ }
+ }
+ msg_send_simple(ctx, RG_SUCCESS,
+ ml->cml_members[x].cn_nodeid, 0);
+ msg_receive(ctx, &hdr, sizeof(hdr), 10);
+ free_member_list(ml);
+}
+
+
+void
flag_reconfigure(int sig)
{
need_reconfigure++;
@@ -417,8 +437,13 @@
switch (msg_hdr->gh_command) {
case RG_STATUS:
clulog(LOG_DEBUG, "Sending service states to CTX%p\n",ctx);
- send_rg_states(ctx, msg_hdr->gh_arg1);
- need_close = 0;
+ if (send_rg_states(ctx, msg_hdr->gh_arg1) == 0)
+ need_close = 0;
+ break;
+
+ case RG_STATUS_NODE:
+ clulog(LOG_DEBUG, "Sending node states to CTX%p\n",ctx);
+ send_node_states(ctx);
break;
case RG_LOCK:
--- cluster/rgmanager/src/utils/clustat.c 2006/09/27 16:43:39 1.23
+++ cluster/rgmanager/src/utils/clustat.c 2006/10/06 21:22:28 1.24
@@ -43,6 +43,94 @@
} rg_state_list_t;
+void
+flag_rgmanager_nodes(cluster_member_list_t *cml)
+{
+ msgctx_t ctx;
+ int max = 0, n;
+ generic_msg_hdr *msgp;
+ fd_set rfds;
+
+ struct timeval tv;
+
+ if (msg_open(MSG_SOCKET, 0, 0, &ctx, 10) < 0)
+ return;
+
+ msg_send_simple(&ctx, RG_STATUS_NODE, 0, 0);
+
+ while (1) {
+ FD_ZERO(&rfds);
+ msg_fd_set(&ctx, &rfds, &max);
+ tv.tv_sec = 10;
+ tv.tv_usec = 0;
+
+ n = select(max+1, &rfds, NULL, NULL, &tv);
+ if (n == 0) {
+ fprintf(stderr, "Timed out waiting for a response "
+ "from Resource Group Manager\n");
+ break;
+ }
+
+ if (n < 0) {
+ if (errno == EAGAIN ||
+ errno == EINTR)
+ continue;
+ fprintf(stderr, "Failed to receive "
+ "service data: select: %s\n",
+ strerror(errno));
+ break;
+ }
+
+ n = msg_receive_simple(&ctx, &msgp, tv.tv_sec);
+
+ if (n < 0) {
+ if (errno == EAGAIN)
+ continue;
+ perror("msg_receive_simple");
+ break;
+ }
+ if (n < sizeof(generic_msg_hdr)) {
+ printf("Error: Malformed message\n");
+ break;
+ }
+
+ if (!msgp) {
+ printf("Error: no message?!\n");
+ break;
+ }
+
+ swab_generic_msg_hdr(msgp);
+
+ if (msgp->gh_command == RG_FAIL) {
+ printf("Member states unavailable: %s\n",
+ rg_strerror(msgp->gh_arg1));
+ free(msgp);
+ msg_close(&ctx);
+ return;
+ }
+
+ if (msgp->gh_command == RG_SUCCESS) {
+ free(msgp);
+ break;
+ }
+
+ for (n = 0; n < cml->cml_count; n++) {
+ if (cml->cml_members[n].cn_nodeid != msgp->gh_arg1)
+ continue;
+ cml->cml_members[n].cn_member |= FLAG_RGMGR;
+ }
+
+ free(msgp);
+ msgp = NULL;
+ }
+
+ msg_send_simple(&ctx, RG_SUCCESS, 0, 0);
+ msg_close(&ctx);
+
+ return;
+}
+
+
rg_state_list_t *
rg_state_list(int local_node_id, int fast)
{
@@ -791,6 +879,9 @@
membership = build_member_list(ch, &local_node_id);
rgs = rg_state_list(local_node_id, fast);
+ if (rgs) {
+ flag_rgmanager_nodes(membership);
+ }
if (refresh_sec) {
setupterm((char *) 0, STDOUT_FILENO, (int *) 0);
next reply other threads:[~2006-10-06 21:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-06 21:22 lhh [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-12-30 8:27 [Cluster-devel] cluster/rgmanager ChangeLog include/resgroup.h fabbione
2007-12-14 19:37 lhh
2007-11-30 20:36 lhh
2007-06-27 14:03 lhh
2007-06-26 21:55 lhh
2007-06-14 15:06 mgrac
2007-06-14 13:36 mgrac
2007-04-27 18:10 lhh
2006-09-01 19:02 lhh
2006-08-18 15:26 lhh
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=20061006212228.11465.qmail@sourceware.org \
--to=lhh@sourceware.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.