public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: ccaulfield@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW daemons/clvmd/Makefile.in dae ...
Date: Wed, 11 Feb 2009 10:13:00 -0000	[thread overview]
Message-ID: <20090211101321.19616.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	ccaulfield@sourceware.org	2009-02-11 10:13:21

Modified files:
	.              : WHATS_NEW 
	daemons/clvmd  : Makefile.in clvmd-corosync.c 

Log message:
	Add a fully-functional get_cluster_name() to clvmd corosync interface.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1041&r2=1.1042
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/Makefile.in.diff?cvsroot=lvm2&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-corosync.c.diff?cvsroot=lvm2&r1=1.4&r2=1.5

--- LVM2/WHATS_NEW	2009/02/10 13:22:18	1.1041
+++ LVM2/WHATS_NEW	2009/02/11 10:13:20	1.1042
@@ -1,5 +1,6 @@
 Version 2.02.45 - 
 ===================================
+  Add a fully-functional get_cluster_name() to clvmd corosync interface.
   Remove duplicate cpg_initialize from clvmd startup.
   Add option to /etc/sysconfig/cluster to select cluster type for clvmd.
   Allow clvmd to start up if its lockspace already exists.
--- LVM2/daemons/clvmd/Makefile.in	2009/02/02 14:34:25	1.26
+++ LVM2/daemons/clvmd/Makefile.in	2009/02/11 10:13:20	1.27
@@ -68,7 +68,7 @@
 
 ifeq ("$(COROSYNC)", "yes")
         SOURCES += clvmd-corosync.c
-        LMLIBS += -lquorum -lcpg -ldlm
+        LMLIBS += -lquorum -lconfdb -lcpg -ldlm
         DEFS += -DUSE_COROSYNC
 endif
 
--- LVM2/daemons/clvmd/clvmd-corosync.c	2009/02/10 13:22:18	1.4
+++ LVM2/daemons/clvmd/clvmd-corosync.c	2009/02/11 10:13:20	1.5
@@ -42,6 +42,7 @@
 #include <corosync/corotypes.h>
 #include <corosync/cpg.h>
 #include <corosync/quorum.h>
+#include <corosync/confdb.h>
 #include <libdlm.h>
 
 #include "locking.h"
@@ -507,7 +508,6 @@
 	return 0;
 }
 
-/* We are always quorate ! */
 static int _is_quorate()
 {
 	int quorate;
@@ -556,10 +556,49 @@
 	return cs_to_errno(err);
 }
 
-/* We don't have a cluster name to report here */
+/*
+ * We are not necessarily connected to a Red Hat Cluster system,
+ * but if we are, this returns the cluster name from cluster.conf.
+ * I've used confdb rather than ccs to reduce the inter-package
+ * dependancies as well as to allow people to set a cluster name
+ * for themselves even if they are not running on RH cluster.
+ */
 static int _get_cluster_name(char *buf, int buflen)
 {
+	confdb_handle_t handle;
+	int result;
+	int namelen = buflen;
+	unsigned int cluster_handle;
+	confdb_callbacks_t callbacks = {
+		.confdb_key_change_notify_fn = NULL,
+		.confdb_object_create_change_notify_fn = NULL,
+		.confdb_object_delete_change_notify_fn = NULL
+	};
+
+	/* This is a default in case everything else fails */
 	strncpy(buf, "Corosync", buflen);
+
+	/* Look for a cluster name in confdb */
+	result = confdb_initialize (&handle, &callbacks);
+        if (result != CS_OK)
+		return 0;
+
+        result = confdb_object_find_start(handle, OBJECT_PARENT_HANDLE);
+	if (result != CS_OK)
+		goto out;
+
+        result = confdb_object_find(handle, OBJECT_PARENT_HANDLE, (void *)"cluster", strlen("cluster"), &cluster_handle);
+        if (result != CS_OK)
+		goto out;
+
+        result = confdb_key_get(handle, cluster_handle, (void *)"name", strlen("name"), buf, &namelen);
+        if (result != CS_OK)
+		goto out;
+
+	buf[namelen] = '\0';
+
+out:
+	confdb_finalize(handle);
 	return 0;
 }
 


             reply	other threads:[~2009-02-11 10:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-11 10:13 ccaulfield [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-02-02 14:34 ccaulfield
2009-01-22 10:21 ccaulfield
2007-06-25  9:02 pcaulfield
2007-06-14 10:16 pcaulfield
2007-05-21 10:52 pcaulfield
2006-10-04  8:22 pcaulfield
2006-03-14 14:18 pcaulfield
2005-02-21 15:58 pcaulfield

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=20090211101321.19616.qmail@sourceware.org \
    --to=ccaulfield@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@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 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).