cluster: RHEL59 - rgmanager: Add IP resource agent "prefer_interface" parameter
by Ryan McCabe
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=9eccf2611b6...
Commit: 9eccf2611b6bfd92e4b15196b4744f24991a7bb8
Parent: 332db7754d6210991c34be056789aa1b33b26a0a
Author: Ryan McCabe <rmccabe(a)redhat.com>
AuthorDate: Tue Jul 24 13:34:35 2012 -0400
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Tue Jul 24 18:13:09 2012 -0400
rgmanager: Add IP resource agent "prefer_interface" parameter
This patch adds a "prefer_interface" parameter for IP resources.
The interface must already be configured and active. This
parameter should be used only when at least two active interfaces
have IP addresses on the same subnet and it's necessary to specify
which particular interface should be used.
Acked-by: Lon Hohberger <lhh(a)redhat.com>
Signed-off-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/resources/ip.sh | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/resources/ip.sh b/rgmanager/src/resources/ip.sh
index 38d1ab9..bbd85f3 100755
--- a/rgmanager/src/resources/ip.sh
+++ b/rgmanager/src/resources/ip.sh
@@ -132,6 +132,15 @@ meta_data()
<content type="boolean"/>
</parameter>
+ <parameter name="prefer_interface">
+ <longdesc lang="en">
+ The network interface to which the IP address should be added. The interface must already be configured and active. This parameter should be used only when at least two active interfaces have IP addresses on the same subnet and it is desired to have the IP address added to a particular interface.
+ </longdesc>
+ <shortdesc lang="en">
+ Network interface
+ </shortdesc>
+ <content type="string"/>
+ </parameter>
</parameters>
<actions>
@@ -587,6 +596,10 @@ ipv6()
fi
if [ "$1" = "add" ]; then
+ if [ -n "$OCF_RESKEY_prefer_interface" ] && \
+ [ "$OCF_RESKEY_prefer_interface" != $dev ]; then
+ continue
+ fi
ipv6_same_subnet $ifaddr_exp/$maskbits $addr_exp
if [ $? -ne 0 ]; then
continue
@@ -670,6 +683,10 @@ ipv4()
fi
if [ "$1" = "add" ]; then
+ if [ -n "$OCF_RESKEY_prefer_interface" ] && \
+ [ "$OCF_RESKEY_prefer_interface" != $dev ]; then
+ continue
+ fi
ipv4_same_subnet $ifaddr/$maskbits $addr
if [ $? -ne 0 ]; then
continue
11 years, 9 months
cluster: RHEL6 - cman init: clarify better comments for FENCE_JOIN=no
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=88e4349b9b6...
Commit: 88e4349b9b636d12b3c51f9c0f734b0259b36954
Parent: 0eecc716d53b4fae15ad131c5d10c628348e0012
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Tue Jul 24 11:24:39 2012 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Jul 24 11:31:39 2012 +0200
cman init: clarify better comments for FENCE_JOIN=no
(input from GSS)
Related: rhbz#821016
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/init.d/cman.in | 7 ++++---
cman/init.d/cman.init.defaults.in | 7 ++++---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
index f39a9aa..9a0d726 100644
--- a/cman/init.d/cman.in
+++ b/cman/init.d/cman.in
@@ -126,9 +126,10 @@ fi
# set to "yes", then the script will attempt to join the fence domain.
# If FENCE_JOIN is set to any other value, the default behavior is
# to join the fence domain (equivalent to "yes").
-# When setting FENCE_JOIN to "no", it is important to check
-# DLM_CONTROLD_OPTS to reflect expected behavior regarding fencing
-# and quorum.
+# When setting FENCE_JOIN to "no", it is important to also set
+# DLM_CONTROLD_OPTS="-f0" (at least) for correct operation.
+# Please note that clusters without fencing are not
+# supported by Red Hat except for MRG installations.
[ -z "$FENCE_JOIN" ] && FENCE_JOIN="yes"
# FENCED_OPTS -- allow extra options to be passed to fence daemon.
diff --git a/cman/init.d/cman.init.defaults.in b/cman/init.d/cman.init.defaults.in
index 6e7f47f..1b7913e 100644
--- a/cman/init.d/cman.init.defaults.in
+++ b/cman/init.d/cman.init.defaults.in
@@ -50,9 +50,10 @@
# set to "yes", then the script will attempt to join the fence domain.
# If FENCE_JOIN is set to any other value, the default behavior is
# to join the fence domain (equivalent to "yes").
-# When setting FENCE_JOIN to "no", it is important to check
-# DLM_CONTROLD_OPTS to reflect expected behavior regarding fencing
-# and quorum.
+# When setting FENCE_JOIN to "no", it is important to also set
+# DLM_CONTROLD_OPTS="-f0" (at least) for correct operation.
+# Please note that clusters without fencing are not
+# supported by Red Hat except for MRG installations.
#FENCE_JOIN="yes"
# FENCED_OPTS -- allow extra options to be passed to fence daemon.
11 years, 9 months
cluster: RHEL6 - cman init: add extra documentation for FENCE_JOIN=""
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=0eecc716d53...
Commit: 0eecc716d53b4fae15ad131c5d10c628348e0012
Parent: 69d2920745d3ac11a44b5d9ce3b07e8eb1d07b25
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Tue May 15 16:37:13 2012 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Jul 24 11:29:59 2012 +0200
cman init: add extra documentation for FENCE_JOIN=""
Related: rhbz#821016
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/init.d/cman.in | 3 +++
cman/init.d/cman.init.defaults.in | 3 +++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
index f345bcc..f39a9aa 100644
--- a/cman/init.d/cman.in
+++ b/cman/init.d/cman.in
@@ -126,6 +126,9 @@ fi
# set to "yes", then the script will attempt to join the fence domain.
# If FENCE_JOIN is set to any other value, the default behavior is
# to join the fence domain (equivalent to "yes").
+# When setting FENCE_JOIN to "no", it is important to check
+# DLM_CONTROLD_OPTS to reflect expected behavior regarding fencing
+# and quorum.
[ -z "$FENCE_JOIN" ] && FENCE_JOIN="yes"
# FENCED_OPTS -- allow extra options to be passed to fence daemon.
diff --git a/cman/init.d/cman.init.defaults.in b/cman/init.d/cman.init.defaults.in
index d6d010c..6e7f47f 100644
--- a/cman/init.d/cman.init.defaults.in
+++ b/cman/init.d/cman.init.defaults.in
@@ -50,6 +50,9 @@
# set to "yes", then the script will attempt to join the fence domain.
# If FENCE_JOIN is set to any other value, the default behavior is
# to join the fence domain (equivalent to "yes").
+# When setting FENCE_JOIN to "no", it is important to check
+# DLM_CONTROLD_OPTS to reflect expected behavior regarding fencing
+# and quorum.
#FENCE_JOIN="yes"
# FENCED_OPTS -- allow extra options to be passed to fence daemon.
11 years, 9 months
cluster: RHEL6 - cman init: allow sysconfig/cman to pass options to dlm_controld
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=69d2920745d...
Commit: 69d2920745d3ac11a44b5d9ce3b07e8eb1d07b25
Parent: 293c73fc93fb82cc427c37df0c088ff39cf25f4c
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Tue May 15 13:53:28 2012 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Jul 24 11:28:58 2012 +0200
cman init: allow sysconfig/cman to pass options to dlm_controld
DLM_CONTROLD_OPTS="" can now be used to pass startup options to the
daemon.
Resolves: rhbz#821016
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/init.d/cman.in | 5 ++++-
cman/init.d/cman.init.defaults.in | 3 +++
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
index 1268b59..f345bcc 100644
--- a/cman/init.d/cman.in
+++ b/cman/init.d/cman.in
@@ -107,6 +107,9 @@ fi
# no (default) | cman will not start sshd
[ -z "$CMAN_SSHD_START" ] && CMAN_SSHD_START=no
+# DLM_CONTROLD_OPTS -- allow extra options to be passed to dlm_controld daemon.
+[ -z "$DLM_CONTROLD_OPTS" ] && DLM_CONTROLD_OPTS=""
+
# FENCE_JOIN_TIMEOUT -- seconds to wait for fence domain join to
# complete. If the join hasn't completed in this time, fence_tool join
# exits with an error, and this script exits with an error. To wait
@@ -615,7 +618,7 @@ stop_fenced()
start_dlm_controld()
{
- start_daemon dlm_controld || return 1
+ start_daemon dlm_controld "$DLM_CONTROLD_OPTS" || return 1
if [ "$INITLOGLEVEL" = "full" ]; then
ok
diff --git a/cman/init.d/cman.init.defaults.in b/cman/init.d/cman.init.defaults.in
index 05c3bc7..d6d010c 100644
--- a/cman/init.d/cman.init.defaults.in
+++ b/cman/init.d/cman.init.defaults.in
@@ -31,6 +31,9 @@
# no (default) | cman will not start sshd
#CMAN_SSHD_START=no
+# DLM_CONTROLD_OPTS -- allow extra options to be passed to dlm_controld daemon.
+#DLM_CONTROLD_OPTS=""
+
# FENCE_JOIN_TIMEOUT -- seconds to wait for fence domain join to
# complete. If the join hasn't completed in this time, fence_tool join
# exits with an error, and this script exits with an error. To wait
11 years, 9 months
cluster: STABLE32 - cman init: clarify better comments for FENCE_JOIN=no
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=224a841585e...
Commit: 224a841585ea300718f9e82d9fadd0f163233e8f
Parent: e8af462b7531f87b5cb20f7204eeb4b520591da9
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Tue Jul 24 11:24:39 2012 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Jul 24 11:24:39 2012 +0200
cman init: clarify better comments for FENCE_JOIN=no
(input from GSS)
Related: rhbz#821016
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
cman/init.d/cman.in | 7 ++++---
cman/init.d/cman.init.defaults.in | 7 ++++---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
index 95323b4..c6e038e 100644
--- a/cman/init.d/cman.in
+++ b/cman/init.d/cman.in
@@ -135,9 +135,10 @@ fi
# set to "yes", then the script will attempt to join the fence domain.
# If FENCE_JOIN is set to any other value, the default behavior is
# to join the fence domain (equivalent to "yes").
-# When setting FENCE_JOIN to "no", it is important to check
-# DLM_CONTROLD_OPTS to reflect expected behavior regarding fencing
-# and quorum.
+# When setting FENCE_JOIN to "no", it is important to also set
+# DLM_CONTROLD_OPTS="-f0" (at least) for correct operation.
+# Please note that clusters without fencing are not
+# supported by Red Hat except for MRG installations.
[ -z "$FENCE_JOIN" ] && FENCE_JOIN="yes"
# FENCED_OPTS -- allow extra options to be passed to fence daemon.
diff --git a/cman/init.d/cman.init.defaults.in b/cman/init.d/cman.init.defaults.in
index b981bab..5be97ff 100644
--- a/cman/init.d/cman.init.defaults.in
+++ b/cman/init.d/cman.init.defaults.in
@@ -58,9 +58,10 @@
# set to "yes", then the script will attempt to join the fence domain.
# If FENCE_JOIN is set to any other value, the default behavior is
# to join the fence domain (equivalent to "yes").
-# When setting FENCE_JOIN to "no", it is important to check
-# DLM_CONTROLD_OPTS to reflect expected behavior regarding fencing
-# and quorum.
+# When setting FENCE_JOIN to "no", it is important to also set
+# DLM_CONTROLD_OPTS="-f0" (at least) for correct operation.
+# Please note that clusters without fencing are not
+# supported by Red Hat except for MRG installations.
#FENCE_JOIN="yes"
# FENCED_OPTS -- allow extra options to be passed to fence daemon.
11 years, 9 months
cluster: RHEL6 - cman: fix a couple of comments
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=293c73fc93f...
Commit: 293c73fc93fb82cc427c37df0c088ff39cf25f4c
Parent: fa9267535f7bbb49dcc766f87f35502dfa623847
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Thu Jul 12 13:00:27 2012 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Jul 24 11:01:01 2012 +0200
cman: fix a couple of comments
Related: rhbz#839241
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/daemon/cman-preconfig.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index 321d78f..99ee80d 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -1538,7 +1538,7 @@ static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, const
objdb->object_destroy(cluster_parent_handle);
/*
- * create cluster.cman in the new config if it doesn't exists
+ * create cluster.cman in the new config if it doesn't exist
*/
objdb->object_find_create(cluster_parent_handle_new, "cman", strlen("cman"), &find_handle);
if (objdb->object_find_next(find_handle, &object_handle)) {
@@ -1548,7 +1548,7 @@ static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, const
objdb->object_find_destroy(find_handle);
/*
- * readd cluster_id/two_node/nodename
+ * write cluster_id/two_node/nodename
*/
snprintf(str, sizeof(str) - 1, "%d", cluster_id);
objdb->object_key_create_typed(object_handle, "cluster_id",
11 years, 9 months
cluster: RHEL6 - cman: fix data copy and memory leak when reloading config
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=fa9267535f7...
Commit: fa9267535f7bbb49dcc766f87f35502dfa623847
Parent: bdbed1f76496e2f3cfc86535314cbeffd4d20257
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Wed Jul 11 11:44:49 2012 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Jul 24 11:00:04 2012 +0200
cman: fix data copy and memory leak when reloading config
cman.cluster_id,nodename,two_node information were not copied
from the old to the new config at reload time. This triggers
a problem when <cman is set in cluster.conf and we effectively
drop information from objdb (suboptimal).
Also fix a possible memory leak when we have reload issues.
Resolves: rhbz#839241
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/daemon/cman-preconfig.c | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index c42052e..321d78f 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -1483,6 +1483,7 @@ static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, const
hdb_handle_t cluster_parent_handle_new;
unsigned int config_version = 0, config_version_new = 0;
char *config_value = NULL;
+ char str[255];
/* don't reload if we've been told to run configless */
if (getenv("CMAN_NOCONFIG")) {
@@ -1494,16 +1495,16 @@ static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, const
/* find both /cluster entries */
objdb->object_find_create(OBJECT_PARENT_HANDLE, "cluster", strlen("cluster"), &find_handle);
objdb->object_find_next(find_handle, &cluster_parent_handle);
+ objdb->object_find_next(find_handle, &cluster_parent_handle_new);
+ objdb->object_find_destroy(find_handle);
if (!cluster_parent_handle) {
sprintf (error_reason, "%s", "Cannot find old /cluster/ key in configuration\n");
goto err;
}
- objdb->object_find_next(find_handle, &cluster_parent_handle_new);
if (!cluster_parent_handle_new) {
sprintf (error_reason, "%s", "Cannot find new /cluster/ key in configuration\n");
goto err;
}
- objdb->object_find_destroy(find_handle);
if (!objdb->object_key_get(cluster_parent_handle, "config_version", strlen("config_version"), (void *)&config_value, NULL)) {
if (config_value) {
@@ -1536,6 +1537,32 @@ static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, const
/* destroy the old one */
objdb->object_destroy(cluster_parent_handle);
+ /*
+ * create cluster.cman in the new config if it doesn't exists
+ */
+ objdb->object_find_create(cluster_parent_handle_new, "cman", strlen("cman"), &find_handle);
+ if (objdb->object_find_next(find_handle, &object_handle)) {
+ objdb->object_create(cluster_parent_handle_new, &object_handle,
+ "cman", strlen("cman"));
+ }
+ objdb->object_find_destroy(find_handle);
+
+ /*
+ * readd cluster_id/two_node/nodename
+ */
+ snprintf(str, sizeof(str) - 1, "%d", cluster_id);
+ objdb->object_key_create_typed(object_handle, "cluster_id",
+ str, strlen(str) + 1, OBJDB_VALUETYPE_STRING);
+
+ if (two_node) {
+ snprintf(str, sizeof(str) - 1, "%d", 1);
+ objdb->object_key_create_typed(object_handle, "two_node",
+ str, strlen(str) + 1, OBJDB_VALUETYPE_STRING);
+ }
+
+ objdb->object_key_create_typed(object_handle, "nodename",
+ nodename, strlen(nodename)+1, OBJDB_VALUETYPE_STRING);
+
/* update the reference to the new config */
cluster_parent_handle = cluster_parent_handle_new;
11 years, 9 months
cluster: RHEL6 - cman-preconfig: allow host aliases as valid cluster nodenames
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=bdbed1f7649...
Commit: bdbed1f76496e2f3cfc86535314cbeffd4d20257
Parent: af86e47803e3626641c1671ac89437d4a82066a7
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Wed Jun 27 11:46:01 2012 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Jul 24 10:47:40 2012 +0200
cman-preconfig: allow host aliases as valid cluster nodenames
Resolves: rhbz#786118
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/daemon/cman-preconfig.c | 91 +++++++++++++++++++++++++++++++++++-------
1 files changed, 76 insertions(+), 15 deletions(-)
diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index c8f69e5..c42052e 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -462,7 +462,7 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *node)
struct sockaddr *sa;
hdb_handle_t nodes_handle;
hdb_handle_t find_handle = 0;
- int error;
+ int found = 0;
/* nodename is either from commandline or from uname */
if (nodelist_byname(objdb, cluster_parent_handle, node))
@@ -508,12 +508,11 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *node)
} while (nodes_handle);
objdb->object_find_destroy(find_handle);
-
- /* The cluster.conf names may not be related to uname at all,
- they may match a hostname on some network interface.
- NOTE: This is IPv4 only */
- error = getifaddrs(&ifa_list);
- if (error)
+ /*
+ * The cluster.conf names may not be related to uname at all,
+ * they may match a hostname on some network interface.
+ */
+ if (getifaddrs(&ifa_list))
return -1;
for (ifa = ifa_list; ifa; ifa = ifa->ifa_next) {
@@ -532,12 +531,13 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *node)
if (sa->sa_family == AF_INET6)
salen = sizeof(struct sockaddr_in6);
- error = getnameinfo(sa, salen, nodename2,
- sizeof(nodename2), NULL, 0, 0);
- if (!error) {
+ if (getnameinfo(sa, salen,
+ nodename2, sizeof(nodename2),
+ NULL, 0, 0) == 0) {
if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
strcpy(node, nodename2);
+ found = 1;
goto out;
}
@@ -548,27 +548,88 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *node)
if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
strcpy(node, nodename2);
+ found = 1;
goto out;
}
}
}
/* See if it's the IP address that's in cluster.conf */
- error = getnameinfo(sa, sizeof(*sa), nodename2,
- sizeof(nodename2), NULL, 0, NI_NUMERICHOST);
- if (error)
+ if (getnameinfo(sa, sizeof(*sa),
+ nodename2, sizeof(nodename2),
+ NULL, 0, NI_NUMERICHOST))
continue;
if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
strcpy(node, nodename2);
+ found = 1;
goto out;
}
}
- error = -1;
out:
+ if (found) {
+ freeifaddrs(ifa_list);
+ return 0;
+ }
+
+ /*
+ * This section covers the usecase where the nodename specified in cluster.conf
+ * is an alias specified in /etc/hosts. For example:
+ * <ipaddr> hostname alias1 alias2
+ * and <clusternode name="alias2">
+ * the above calls use uname and getnameinfo does not return aliases.
+ * here we take the name specified in cluster.conf, resolve it to an address
+ * and then compare against all known local ip addresses.
+ * if we have a match, we found our nodename. In theory this chunk of code
+ * could replace all the checks above, but let's avoid any possible regressions
+ * and use it as last.
+ */
+
+ nodes_handle = nodeslist_init(objdb, cluster_parent_handle, &find_handle);
+ while (nodes_handle) {
+ char *dbnodename = NULL;
+ struct addrinfo hints;
+ struct addrinfo *result = NULL, *rp = NULL;
+
+ if (objdb_get_string(objdb, nodes_handle, "name", &dbnodename)) {
+ goto next;
+ }
+
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_DGRAM;
+ hints.ai_flags = 0;
+ hints.ai_protocol = IPPROTO_UDP;
+
+ if (getaddrinfo(dbnodename, NULL, &hints, &result))
+ goto next;
+
+ for (rp = result; rp != NULL; rp = rp->ai_next) {
+ for (ifa = ifa_list; ifa; ifa = ifa->ifa_next) {
+ if (ipaddr_equal((struct sockaddr_storage *)rp->ai_addr,
+ (struct sockaddr_storage *)ifa->ifa_addr)) {
+ freeaddrinfo(result);
+ strncpy(node, dbnodename, sizeof(nodename) - 1);
+ found = 1;
+ goto out2;
+ }
+ }
+ }
+
+ freeaddrinfo(result);
+ next:
+ nodes_handle = nodeslist_next(objdb, find_handle);
+ }
+ out2:
+ objdb->object_find_destroy(find_handle);
freeifaddrs(ifa_list);
- return error;
+
+ if (found) {
+ return 0;
+ }
+
+ return -1;
}
/* Get any environment variable overrides */
11 years, 9 months
cluster: RHEL6 - config: Fix typo in schema
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=af86e47803e...
Commit: af86e47803e3626641c1671ac89437d4a82066a7
Parent: 5674e99cd0b141c34630ec411e0d682727a30dc9
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Jan 30 16:35:52 2012 -0500
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Jul 24 10:39:23 2012 +0200
config: Fix typo in schema
Resolves: rhbz#785866
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
config/tools/xml/cluster.rng.in.head | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/config/tools/xml/cluster.rng.in.head b/config/tools/xml/cluster.rng.in.head
index 1bdb836..4e3d901 100644
--- a/config/tools/xml/cluster.rng.in.head
+++ b/config/tools/xml/cluster.rng.in.head
@@ -20,7 +20,7 @@ cluster
- rm
- clvmd
-Element defnitions:
+Element definitions:
- Resource
- Fence
11 years, 9 months
cluster: RHEL6 - qdiskd: allow master to failover quickly when using master_wins
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=5674e99cd0b...
Commit: 5674e99cd0b141c34630ec411e0d682727a30dc9
Parent: e01a564837cc5f5310a046da3c71f995c301e649
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Tue Jul 24 10:27:57 2012 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Jul 24 10:34:25 2012 +0200
qdiskd: allow master to failover quickly when using master_wins
in case of master_wins and we are shutting down the master qdiskd,
there is a small window in which the other node is not quorate
because qdiskd has not become master yet.
this patch allows the master qdiskd to communicate to the other
nodes that it is going away and gives enough time to elect
a new master before dieing.
the process itself is safe and the worst case scenario the cluster
will behave as-is now (temporary loss of quorum), otherwise a fast
switch will take place.
Resolves: rhbz#814807
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
---
cman/qdisk/disk.h | 5 +++-
cman/qdisk/main.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 75 insertions(+), 2 deletions(-)
diff --git a/cman/qdisk/disk.h b/cman/qdisk/disk.h
index fd80fa6..6bed41d 100644
--- a/cman/qdisk/disk.h
+++ b/cman/qdisk/disk.h
@@ -24,9 +24,12 @@ typedef enum {
S_INIT = 0x2, // Initializing. Hold your fire.
/* vvv Fencing will kill a node */
S_RUN = 0x5, // I think I'm running.
- S_MASTER= 0x6 // I know I'm running, and have advertised to
+ S_MASTER= 0x6, // I know I'm running, and have advertised to
// CMAN the availability of the disk vote for my
// partition.
+ S_EXIT = 0x7 // trigger master re-election before exit
+ // status is set only by master in master-win | auto-masterwin
+ // and next status _must_ be S_NONE
} disk_node_state_t;
diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c
index fc714f6..594e9e8 100644
--- a/cman/qdisk/main.c
+++ b/cman/qdisk/main.c
@@ -194,7 +194,8 @@ read_node_blocks(qd_ctx *ctx, node_info_t *ni, int max)
continue;
/* Unchanged timestamp: miss */
- if (sb->ps_timestamp == ni[x].ni_last_seen) {
+ if ((sb->ps_timestamp == ni[x].ni_last_seen) &&
+ (ni[x].ni_state != S_EXIT)) {
/* XXX check for average + allow grace */
ni[x].ni_misses++;
if (ni[x].ni_misses > 1) {
@@ -229,6 +230,22 @@ check_transitions(qd_ctx *ctx, node_info_t *ni, int max, memb_mask_t mask)
for (x = 0; x < max; x++) {
/*
+ Case 0: check if master node is about to leave
+ */
+ if (ni[x].ni_state == S_EXIT) {
+ logt_print(LOG_NOTICE, "Node %d is about to leave\n", ni[x].ni_status.ps_nodeid);
+ ni[x].ni_evil_incarnation = 0;
+ ni[x].ni_incarnation = 0;
+ ni[x].ni_seen = 0;
+ ni[x].ni_misses = 0;
+ ni[x].ni_state = S_NONE;
+ if (mask)
+ clear_bit(mask, (ni[x].ni_status.ps_nodeid-1),
+ sizeof(memb_mask_t));
+ continue;
+ }
+
+ /*
Case 1: check to see if the node is still up
according to our internal state, but has been
evicted by the master or cleanly shut down
@@ -1259,6 +1276,50 @@ quorum_loop(qd_ctx *ctx, node_info_t *ni, int max)
/**
+ Tell the other nodes to elect a new master != me.
+ */
+static int
+quorum_reelect_master(qd_ctx *ctx, node_info_t *ni, int max)
+{
+ if (qd_write_status(ctx, ctx->qc_my_id, S_EXIT,
+ NULL, NULL, NULL) != 0) {
+ logt_print(LOG_WARNING,
+ "Error writing to quorum disk during reelect_master\n");
+ }
+
+ while (1) {
+ int master, x;
+ int found = 0;
+ int low_id, count;
+
+ read_node_blocks(ctx, ni, max);
+
+ for (x = 0; x < max; x++) {
+ if (ni[x].ni_state >= S_RUN) {
+ found = 1;
+ }
+ }
+
+ if (!found) {
+ logt_print(LOG_DEBUG, "No other nodes are active. Exiting\n");
+ break;
+ }
+
+ master = master_exists(ctx, ni, max, &low_id, &count);
+ if (master) {
+ logt_print(LOG_DEBUG, "New master elected: %d\n", master);
+ break;
+ }
+ /*
+ * give time for message to be read
+ */
+ sleep(1);
+ }
+
+ return 0;
+}
+
+/**
Tell the other nodes we're done (safely!).
*/
static int
@@ -2151,6 +2212,15 @@ main(int argc, char **argv)
io_nanny_start(ch_user, ctx.qc_tko * ctx.qc_interval);
if (quorum_loop(&ctx, ni, MAX_NODES_DISK) == 0) {
+ /*
+ * if we are master and we are in master-win mode,
+ * request other qdiskd to elect a new one
+ */
+ if ((ctx.qc_status == S_MASTER) &&
+ ((ctx.qc_flags & RF_MASTER_WINS) ||
+ (ctx.qc_flags & RF_AUTO_MASTER_WINS))) {
+ quorum_reelect_master(&ctx, ni, MAX_NODES_DISK);
+ }
/* Only clean up if we're exiting w/o error) */
logt_print(LOG_NOTICE, "Unregistering quorum device.\n");
cman_unregister_quorum_device(ctx.qc_cman_admin);
11 years, 9 months