summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Caulfield <pcaulfie@redhat.com>2006-10-09 14:11:57 +0000
committerPatrick Caulfield <pcaulfie@redhat.com>2006-10-09 14:11:57 +0000
commitefa483c599f23d10160c2b7e9c3b4e75812b9b41 (patch)
tree173c22f13187c80eb4f8c8589fb220340ec475ad
parentde5c82a0d991e4c02819b1f71c9a2ab8143e01bb (diff)
downloadlvm2-efa483c599f23d10160c2b7e9c3b4e75812b9b41.tar.gz
lvm2-efa483c599f23d10160c2b7e9c3b4e75812b9b41.tar.xz
lvm2-efa483c599f23d10160c2b7e9c3b4e75812b9b41.zip
Add clvmd call to return the cluster name.
-rw-r--r--WHATS_NEW1
-rw-r--r--daemons/clvmd/clvm.h1
-rw-r--r--daemons/clvmd/clvmd-cman.c13
-rw-r--r--daemons/clvmd/clvmd-command.c9
-rw-r--r--daemons/clvmd/clvmd-comms.h2
-rw-r--r--daemons/clvmd/clvmd-gulm.c7
-rw-r--r--daemons/clvmd/clvmd.c2
7 files changed, 34 insertions, 1 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index d9100d6b..2d49b357 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.11 -
=====================================
+ Add clvmd function to return the cluster name. not used by LVM yet.
Add cling allocation policy.
Change _check_contiguous() to use _for_each_pv().
Extend _for_each_pv() to allow termination without error.
diff --git a/daemons/clvmd/clvm.h b/daemons/clvmd/clvm.h
index c8106019..3eff0ce1 100644
--- a/daemons/clvmd/clvm.h
+++ b/daemons/clvmd/clvm.h
@@ -65,5 +65,6 @@ static const char CLVMD_SOCKNAME[] = "\0clvmd";
/* Misc functions */
#define CLVMD_CMD_REFRESH 40
+#define CLVMD_CMD_GET_CLUSTERNAME 41
#endif
diff --git a/daemons/clvmd/clvmd-cman.c b/daemons/clvmd/clvmd-cman.c
index b2c32e2b..0dc005dc 100644
--- a/daemons/clvmd/clvmd-cman.c
+++ b/daemons/clvmd/clvmd-cman.c
@@ -471,6 +471,18 @@ static int _sync_unlock(const char *resource /* UNUSED */, int lockid)
}
+static int _get_cluster_name(char *buf, int buflen)
+{
+ cman_cluster_t cluster_info;
+ int status;
+
+ status = cman_get_cluster(c_handle, &cluster_info);
+ if (!status) {
+ strncpy(buf, cluster_info.ci_name, buflen);
+ }
+ return status;
+}
+
static struct cluster_ops _cluster_cman_ops = {
.cluster_init_completed = _cluster_init_completed,
.cluster_send_message = _cluster_send_message,
@@ -484,6 +496,7 @@ static struct cluster_ops _cluster_cman_ops = {
.get_our_csid = _get_our_csid,
.add_up_node = _add_up_node,
.cluster_closedown = _cluster_closedown,
+ .get_cluster_name = _get_cluster_name,
.sync_lock = _sync_lock,
.sync_unlock = _sync_unlock,
};
diff --git a/daemons/clvmd/clvmd-command.c b/daemons/clvmd/clvmd-command.c
index 9ba6e49b..936ca7e0 100644
--- a/daemons/clvmd/clvmd-command.c
+++ b/daemons/clvmd/clvmd-command.c
@@ -75,6 +75,8 @@
#include "clvmd.h"
#include "libdlm.h"
+extern struct cluster_ops *clops;
+
/* This is where all the real work happens:
NOTE: client will be NULL when this is executed on a remote node */
int do_command(struct local_client *client, struct clvm_header *msg, int msglen,
@@ -126,6 +128,12 @@ int do_command(struct local_client *client, struct clvm_header *msg, int msglen,
do_refresh_cache();
break;
+ case CLVMD_CMD_GET_CLUSTERNAME:
+ status = clops->get_cluster_name(*buf, buflen);
+ if (!status)
+ *retlen = strlen(*buf);
+ break;
+
default:
/* Won't get here because command is validated in pre_command */
break;
@@ -227,6 +235,7 @@ int do_pre_command(struct local_client *client)
break;
case CLVMD_CMD_REFRESH:
+ case CLVMD_CMD_GET_CLUSTERNAME:
break;
default:
diff --git a/daemons/clvmd/clvmd-comms.h b/daemons/clvmd/clvmd-comms.h
index 39b286e6..6bfcd562 100644
--- a/daemons/clvmd/clvmd-comms.h
+++ b/daemons/clvmd/clvmd-comms.h
@@ -43,6 +43,8 @@ struct cluster_ops {
void (*reread_config) (void);
void (*cluster_closedown) (void);
+ int (*get_cluster_name)(char *buf, int buflen);
+
int (*sync_lock) (const char *resource, int mode, int flags, int *lockid);
int (*sync_unlock) (const char *resource, int lockid);
diff --git a/daemons/clvmd/clvmd-gulm.c b/daemons/clvmd/clvmd-gulm.c
index 058138cc..ebf066e3 100644
--- a/daemons/clvmd/clvmd-gulm.c
+++ b/daemons/clvmd/clvmd-gulm.c
@@ -973,6 +973,12 @@ static int _cluster_send_message(void *buf, int msglen, char *csid, const char *
return gulm_cluster_send_message(buf, msglen, csid, errtext);
}
+static int _get_cluster_name(char *buf, int buflen)
+{
+ strncpy(buf, cluster_name, buflen);
+ return 0;
+}
+
static struct cluster_ops _cluster_gulm_ops = {
.cluster_init_completed = NULL,
.cluster_send_message = _cluster_send_message,
@@ -987,6 +993,7 @@ static struct cluster_ops _cluster_gulm_ops = {
.add_up_node = gulm_add_up_node,
.reread_config = _reread_config,
.cluster_closedown = _cluster_closedown,
+ .get_cluster_name = _get_cluster_name,
.sync_lock = _sync_lock,
.sync_unlock = _sync_unlock,
};
diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c
index a8e037aa..17c7a22c 100644
--- a/daemons/clvmd/clvmd.c
+++ b/daemons/clvmd/clvmd.c
@@ -67,7 +67,7 @@ static struct local_client local_client_head;
static unsigned short global_xid = 0; /* Last transaction ID issued */
-static struct cluster_ops *clops = NULL;
+struct cluster_ops *clops = NULL;
static char our_csid[MAX_CSID_LEN];
static unsigned max_csid_len;