[Ocfs2-tools-devel] [PATCH] ocfs2_controld: code update for calling get_ais_nodeid()

Coly Li coly.li at suse.de
Sun Apr 12 09:43:59 PDT 2009


function get_ais_nodeid in pacemaker upstream is changed from "int
get_ais_nodeid()" to "gboolean get_ais_nodeid(uint32_t *id, char **uname)".

Current ocfs2-tools code gets compiling error with upstream pacemaker code
installed.

This patch update the calling method to get_ais_nodeid().

Signed-off-by: Coly Li <coly.li at suse.de>
Cc: Andrew Beekhof <abeekhof at suse.de>
---
 ocfs2_controld/pacemaker.c |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/ocfs2_controld/pacemaker.c b/ocfs2_controld/pacemaker.c
index 53eacff..104e277 100644
--- a/ocfs2_controld/pacemaker.c
+++ b/ocfs2_controld/pacemaker.c
@@ -383,20 +383,11 @@ int setup_stack(void)
 	int pid;
 	char *pid_s;
 	int rc = SA_AIS_OK;
-	struct utsname name;
+	char *uname;

 	crm_log_init("ocfs2_controld", LOG_INFO, FALSE, TRUE, 0, NULL);
 	crm_peer_init();

-	if (local_node_uname == NULL) {
-		if (uname(&name) < 0) {
-			cl_perror("uname(2) call failed");
-			exit(100);
-		}
-		local_node_uname = crm_strdup(name.nodename);
-		log_debug("Local node name: %s", local_node_uname);
-	}
-
 retry:
 	log_debug("Creating connection to our AIS plugin");
 	rc = saServiceConnect (&ais_fd_sync, &ais_fd_async, CRM_SERVICE);
@@ -432,8 +423,13 @@ retry:
 	/* Requesting the current list of known nodes */
 	send_ais_text(crm_class_members, __FUNCTION__, TRUE, NULL, crm_msg_ais);

-	our_nodeid = get_ais_nodeid();
+	get_ais_nodeid(&our_nodeid, &uname);
+	if (local_node_uname == NULL)
+		local_node_uname = uname;
+	else
+		crm_free(uname);
 	log_debug("Local node id: %d", our_nodeid);
+	log_debug("Local node name: %s", local_node_uname);

 	pcmk_ci = connection_add(ais_fd_async, process_pcmk, dead_pcmk);
 	if (pcmk_ci >= 0 && setup_stonith())
-- 
Coly Li
SuSE Labs



More information about the Ocfs2-tools-devel mailing list