Update to new upstream HEAD

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
This commit is contained in:
Fabio M. Di Nitto 2012-02-16 12:38:24 +01:00
parent a3710f70c5
commit ee6c2ef482
6 changed files with 409 additions and 134 deletions

View File

@ -1,22 +1,20 @@
Name: dlm Name: dlm
Version: 3.99.0 Version: 3.99.0
Release: 6%{?dist} Release: 7%{?dist}
License: GPLv2 and GPLv2+ and LGPLv2+ License: GPLv2 and GPLv2+ and LGPLv2+
# For a breakdown of the licensing, see README.license # For a breakdown of the licensing, see README.license
Group: System Environment/Kernel Group: System Environment/Kernel
Summary: Cluster control daemon and tool Summary: Cluster control daemon and tool
URL: https://fedorahosted.org/cluster URL: https://fedorahosted.org/cluster
BuildRequires: glibc-kernheaders BuildRequires: glibc-kernheaders
BuildRequires: corosynclib-devel >= 1.99.0 BuildRequires: corosynclib-devel >= 1.99.4
BuildRequires: libxml2-devel BuildRequires: libxml2-devel
BuildRequires: systemd-units BuildRequires: systemd-units
Requires: %{name}-lib = %{version}-%{release}
Source0: http://people.redhat.com/teigland/%{name}-%{version}.tar.gz Source0: http://people.redhat.com/teigland/%{name}-%{version}.tar.gz
Patch0: fix_udev_rules.patch Patch0: upstream_head_2ad89c869.patch
Patch1: fix_systemd_service.patch
Patch2: fix_systemd_service_part2.patch
Patch3: fix_init_bits.patch
Requires: %{name}-lib = %{version}-%{release}
Requires: corosync >= 1.99.4
Requires(post): systemd-units Requires(post): systemd-units
Requires(preun): systemd-units Requires(preun): systemd-units
Requires(postun): systemd-units Requires(postun): systemd-units
@ -28,9 +26,6 @@ The kernel dlm requires a user daemon to control cluster membership.
%prep %prep
%setup -q %setup -q
%patch0 -p1 %patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build %build
# upstream does not require configure # upstream does not require configure
@ -104,6 +99,10 @@ developing applications that use %{name}.
%{_libdir}/pkgconfig/*.pc %{_libdir}/pkgconfig/*.pc
%changelog %changelog
* Thu Feb 16 2012 Fabio M. Di Nitto <fdinitto@redhat.com> - 3.99.0-7
- Update to upstream HEAD 2ad89c869git.
- Bump BuildRequires and Requires to new corosync
* Mon Feb 13 2012 Fabio M. Di Nitto <fdinitto@redhat.com> - 3.99.0-6 * Mon Feb 13 2012 Fabio M. Di Nitto <fdinitto@redhat.com> - 3.99.0-6
- Fix init/systemd service to use /etc/sysconfig/dlm - Fix init/systemd service to use /etc/sysconfig/dlm

View File

@ -1,39 +0,0 @@
commit 0f19d2e7fb331ba3aedc69c6bd3eb5a75cf631c5
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date: Mon Feb 13 06:15:32 2012 +0100
init/service scripts: make environment filename consistent with service name
Generally speaking if a service is called foo, users expects to pass
options to the script via /etc/sysconfig/foo and not foo_something.
This fix an oversight on my side in the previous round of init fixes.
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
diff --git a/init/dlm.init b/init/dlm.init
index db8f17f..7f3da2d 100644
--- a/init/dlm.init
+++ b/init/dlm.init
@@ -26,7 +26,7 @@ progdir="cluster"
lockfile="/var/run/$progdir/$prog.pid"
exec="/usr/sbin/$prog"
-[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+[ -f /etc/sysconfig/dlm ] && . /etc/sysconfig/dlm
setup() {
modprobe dlm > /dev/null 2>&1
diff --git a/init/dlm.service b/init/dlm.service
index 7be2ffd..d7cf9c7 100644
--- a/init/dlm.service
+++ b/init/dlm.service
@@ -4,7 +4,7 @@ After=syslog.target network.target corosync.service
[Service]
Type=forking
-EnvironmentFile=/etc/sysconfig/dlm_controld
+EnvironmentFile=/etc/sysconfig/dlm
ExecStartPre=/sbin/modprobe dlm
ExecStart=/usr/sbin/dlm_controld $DLM_CONTROLD_OPTS
#ExecStopPost=/sbin/modprobe -r dlm

View File

@ -1,24 +0,0 @@
commit 1ea3f422e7add8730e07029fc9f30aa38ddded2f
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date: Fri Feb 3 16:40:30 2012 +0100
systemd: modprobe dlm on start
also add commented out modprobe removal on stop
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
diff --git a/init/dlm.service b/init/dlm.service
index e275843..17579c2 100644
--- a/init/dlm.service
+++ b/init/dlm.service
@@ -4,7 +4,9 @@ After=syslog.target network.target corosync.service
[Service]
Type=forking
+ExecStartPre=/sbin/modprobe dlm
ExecStart=/usr/sbin/dlm_controld $OPTIONS
+#ExecStopPost=/sbin/modprobe -r dlm
[Install]
WantedBy=multi-user.target

View File

@ -1,26 +0,0 @@
commit 3a7c2f696f00b2edfcbc4a5b7cd2cd7128f61f0a
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date: Mon Feb 6 13:26:47 2012 +0100
systemd: align with init script functionalities
Enable use of /etc/sysconfig/dlm_controld and use DLM_CONTROLD_OPTS
for both systemd and init script
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
diff --git a/init/dlm.service b/init/dlm.service
index 17579c2..7be2ffd 100644
--- a/init/dlm.service
+++ b/init/dlm.service
@@ -4,8 +4,9 @@ After=syslog.target network.target corosync.service
[Service]
Type=forking
+EnvironmentFile=/etc/sysconfig/dlm_controld
ExecStartPre=/sbin/modprobe dlm
-ExecStart=/usr/sbin/dlm_controld $OPTIONS
+ExecStart=/usr/sbin/dlm_controld $DLM_CONTROLD_OPTS
#ExecStopPost=/sbin/modprobe -r dlm
[Install]

View File

@ -1,35 +0,0 @@
commit 5d55eebda689be8f62bcf75e02d99777b6442b08
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date: Fri Feb 3 15:16:09 2012 +0100
libdlm: fix udev rules to deal with misc contrains
new kernels do not allow renaming of certain class of char devices,
and that means that new dlm* devices are created in /dev instead
of /dev/misc.
Change udev rules to create compat SYMLINKS in /dev/misc and
maintain the same file modes.
Also update to deal with dlm_plock and drop dlm_default that is
not referenced neither in kernel or userland.
This also fixes a dlm_controld segfaults on closing connections
to dlm_plock.
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
diff --git a/libdlm/51-dlm.rules b/libdlm/51-dlm.rules
index f71e79d..9d21fc0 100644
--- a/libdlm/51-dlm.rules
+++ b/libdlm/51-dlm.rules
@@ -1,5 +1,4 @@
-KERNEL=="dlm-control", NAME="misc/dlm-control", MODE="0666"
-KERNEL=="dlm-monitor", NAME="misc/dlm-monitor", MODE="0666"
-KERNEL=="dlm_default", NAME="misc/dlm_default", MODE="0666"
-KERNEL=="dlm_*", NAME="misc/%k", MODE="0660"
-
+KERNEL=="dlm-control", MODE="0666", SYMLINK+="misc/dlm-control"
+KERNEL=="dlm-monitor", MODE="0666", SYMLINK+="misc/dlm-monitor"
+KERNEL=="dlm_plock", MODE="0666", SYMLINK+="misc/dlm_plock"
+KERNEL=="dlm_*", MODE="0660", SYMLINK+="misc/%k"

View File

@ -0,0 +1,400 @@
diff --git a/dlm_controld/action.c b/dlm_controld/action.c
index ae3f6cd..d4bf11d 100644
--- a/dlm_controld/action.c
+++ b/dlm_controld/action.c
@@ -67,14 +67,14 @@ static int detect_cluster_name(void)
return -1;
}
- rv = cmap_get_string(handle, "cluster.name", &str);
+ rv = cmap_get_string(handle, "totem.cluster_name", &str);
if (rv != CS_OK) {
- log_error("cmap_get_string cluster.name error %d", rv);
+ log_error("cmap_get_string totem.cluster_name error %d", rv);
goto out;
} else
err = 0;
- log_debug("cmap cluster.name = '%s'", str);
+ log_debug("cmap totem.cluster_name = '%s'", str);
strncpy(cluster_name, str, DLM_LOCKSPACE_LEN);
out:
@@ -848,10 +848,12 @@ int setup_configfs_options(void)
detect_cluster_name();
- if (cluster_name[0])
+ if (cluster_name[0]) {
set_configfs_cluster("cluster_name", cluster_name, 0);
- else
+ } else {
log_error("no cluster name");
+ return -1;
+ }
}
return 0;
}
diff --git a/dlm_controld/cpg.c b/dlm_controld/cpg.c
index f490cf5..ced912f 100644
--- a/dlm_controld/cpg.c
+++ b/dlm_controld/cpg.c
@@ -280,7 +280,7 @@ const char *msg_name(int type)
static int _send_message(cpg_handle_t h, void *buf, int len, int type)
{
struct iovec iov;
- cpg_error_t error;
+ cs_error_t error;
int retries = 0;
iov.iov_base = buf;
@@ -288,7 +288,7 @@ static int _send_message(cpg_handle_t h, void *buf, int len, int type)
retry:
error = cpg_mcast_joined(h, CPG_TYPE_AGREED, &iov, 1);
- if (error == CPG_ERR_TRY_AGAIN) {
+ if (error == CS_ERR_TRY_AGAIN) {
retries++;
usleep(1000);
if (!(retries % 100))
@@ -296,7 +296,7 @@ static int _send_message(cpg_handle_t h, void *buf, int len, int type)
retries, msg_name(type));
goto retry;
}
- if (error != CPG_OK) {
+ if (error != CS_OK) {
log_error("cpg_mcast_joined error %d handle %llx %s",
error, (unsigned long long)h, msg_name(type));
return -1;
@@ -686,6 +686,11 @@ static int need_fencing(struct lockspace *ls)
return 0;
}
+/* we don't need to ask fenced to initiate fencing; it does
+ so itself when it sees a fence domain member fail. Without
+ fenced we'll probably need to ask another daemon to initiate
+ fencing, then check with it above, like we check libfenced. */
+
static void request_fencing(struct lockspace *ls)
{
struct node *node;
@@ -693,12 +698,7 @@ static void request_fencing(struct lockspace *ls)
list_for_each_entry(node, &ls->node_history, list) {
if (!node->request_fencing)
continue;
-
- /* we don't need to ask fenced to initiate fencing; it does
- so itself when it sees a fence domain member fail. Without
- fenced we'll probably need to ask another daemon to initiate
- fencing, then check with it above, like we check libfenced. */
-
+ fence_request(node->nodeid);
node->request_fencing = 0;
}
}
@@ -1886,11 +1886,11 @@ static cpg_model_v1_data_t cpg_callbacks = {
void update_flow_control_status(void)
{
cpg_flow_control_state_t flow_control_state;
- cpg_error_t error;
+ cs_error_t error;
error = cpg_flow_control_state_get(cpg_handle_daemon,
&flow_control_state);
- if (error != CPG_OK) {
+ if (error != CS_OK) {
log_error("cpg_flow_control_state_get %d", error);
return;
}
@@ -1911,7 +1911,7 @@ void update_flow_control_status(void)
static void process_cpg_lockspace(int ci)
{
struct lockspace *ls;
- cpg_error_t error;
+ cs_error_t error;
ls = find_ls_ci(ci);
if (!ls) {
@@ -1919,8 +1919,8 @@ static void process_cpg_lockspace(int ci)
return;
}
- error = cpg_dispatch(ls->cpg_handle, CPG_DISPATCH_ALL);
- if (error != CPG_OK) {
+ error = cpg_dispatch(ls->cpg_handle, CS_DISPATCH_ALL);
+ if (error != CS_OK) {
log_error("cpg_dispatch error %d", error);
return;
}
@@ -1932,7 +1932,7 @@ static void process_cpg_lockspace(int ci)
int dlm_join_lockspace(struct lockspace *ls)
{
- cpg_error_t error;
+ cs_error_t error;
cpg_handle_t h;
struct cpg_name name;
int i = 0, fd, ci, rv;
@@ -1947,7 +1947,7 @@ int dlm_join_lockspace(struct lockspace *ls)
error = cpg_model_initialize(&h, CPG_MODEL_V1,
(cpg_model_data_t *)&cpg_callbacks, NULL);
- if (error != CPG_OK) {
+ if (error != CS_OK) {
log_error("cpg_model_initialize error %d", error);
rv = -1;
goto fail_free;
@@ -1976,13 +1976,13 @@ int dlm_join_lockspace(struct lockspace *ls)
log_group(ls, "cpg_join %s ...", name.value);
retry:
error = cpg_join(h, &name);
- if (error == CPG_ERR_TRY_AGAIN) {
+ if (error == CS_ERR_TRY_AGAIN) {
sleep(1);
if (!(++i % 10))
log_error("cpg_join error retrying");
goto retry;
}
- if (error != CPG_OK) {
+ if (error != CS_OK) {
log_error("cpg_join error %d", error);
cpg_finalize(h);
rv = -1;
@@ -2005,7 +2005,7 @@ int dlm_join_lockspace(struct lockspace *ls)
int dlm_leave_lockspace(struct lockspace *ls)
{
- cpg_error_t error;
+ cs_error_t error;
struct cpg_name name;
int i = 0;
@@ -2017,13 +2017,13 @@ int dlm_leave_lockspace(struct lockspace *ls)
retry:
error = cpg_leave(ls->cpg_handle, &name);
- if (error == CPG_ERR_TRY_AGAIN) {
+ if (error == CS_ERR_TRY_AGAIN) {
sleep(1);
if (!(++i % 10))
log_error("cpg_leave error retrying");
goto retry;
}
- if (error != CPG_OK)
+ if (error != CS_OK)
log_error("cpg_leave error %d", error);
return 0;
@@ -2563,16 +2563,16 @@ static cpg_model_v1_data_t cpg_callbacks_daemon = {
void process_cpg_daemon(int ci)
{
- cpg_error_t error;
+ cs_error_t error;
- error = cpg_dispatch(cpg_handle_daemon, CPG_DISPATCH_ALL);
- if (error != CPG_OK)
+ error = cpg_dispatch(cpg_handle_daemon, CS_DISPATCH_ALL);
+ if (error != CS_OK)
log_error("daemon cpg_dispatch error %d", error);
}
int setup_cpg_daemon(void)
{
- cpg_error_t error;
+ cs_error_t error;
struct cpg_name name;
int i = 0;
@@ -2597,7 +2597,7 @@ int setup_cpg_daemon(void)
error = cpg_model_initialize(&cpg_handle_daemon, CPG_MODEL_V1,
(cpg_model_data_t *)&cpg_callbacks_daemon,
NULL);
- if (error != CPG_OK) {
+ if (error != CS_OK) {
log_error("daemon cpg_initialize error %d", error);
return -1;
}
@@ -2611,13 +2611,13 @@ int setup_cpg_daemon(void)
log_debug("cpg_join %s ...", name.value);
retry:
error = cpg_join(cpg_handle_daemon, &name);
- if (error == CPG_ERR_TRY_AGAIN) {
+ if (error == CS_ERR_TRY_AGAIN) {
sleep(1);
if (!(++i % 10))
log_error("daemon cpg_join error retrying");
goto retry;
}
- if (error != CPG_OK) {
+ if (error != CS_OK) {
log_error("daemon cpg_join error %d", error);
goto fail;
}
@@ -2633,7 +2633,7 @@ int setup_cpg_daemon(void)
void close_cpg_daemon(void)
{
struct lockspace *ls;
- cpg_error_t error;
+ cs_error_t error;
struct cpg_name name;
int i = 0;
@@ -2649,13 +2649,13 @@ void close_cpg_daemon(void)
log_debug("cpg_leave %s ...", name.value);
retry:
error = cpg_leave(cpg_handle_daemon, &name);
- if (error == CPG_ERR_TRY_AGAIN) {
+ if (error == CS_ERR_TRY_AGAIN) {
sleep(1);
if (!(++i % 10))
log_error("daemon cpg_leave error retrying");
goto retry;
}
- if (error != CPG_OK)
+ if (error != CS_OK)
log_error("daemon cpg_leave error %d", error);
fin:
list_for_each_entry(ls, &lockspaces, list) {
diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h
index 497e6e8..3899550 100644
--- a/dlm_controld/dlm_daemon.h
+++ b/dlm_controld/dlm_daemon.h
@@ -348,6 +348,7 @@ void process_cluster_cfg(int ci);
void kick_node_from_cluster(int nodeid);
/* fence.c */
+void fence_request(int nodeid);
int fence_node_time(int nodeid, uint64_t *last_fenced_time);
int fence_in_progress(int *count);
diff --git a/dlm_controld/fence.c b/dlm_controld/fence.c
index 95a8bc1..f91d9de 100644
--- a/dlm_controld/fence.c
+++ b/dlm_controld/fence.c
@@ -7,38 +7,30 @@
*/
#include "dlm_daemon.h"
-//#include "libfenced.h"
+#ifdef STONITH
+#include <pacemaker/crm/stonith-ng.h>
+#endif
-int fence_node_time(int nodeid, uint64_t *last_fenced_time)
+void fence_request(int nodeid)
{
-/*
- struct fenced_node nodeinfo;
+#ifdef STONITH
int rv;
+ rv = stonith_api_kick_cs_helper(nodeid, 300, 1);
+ if (rv)
+ log_error("stonith_api_kick_cs_helper %d error %d", nodeid, rv);
+#endif
+}
- memset(&nodeinfo, 0, sizeof(nodeinfo));
-
- rv = fenced_node_info(nodeid, &nodeinfo);
- if (rv < 0)
- return rv;
-
- *last_fenced_time = nodeinfo.last_fenced_time;
-*/
+int fence_node_time(int nodeid, uint64_t *last_fenced_time)
+{
+#ifdef STONITH
+ *last_fenced_time = stonith_api_time_cs_helper(nodeid, 0);
+#endif
return 0;
}
int fence_in_progress(int *count)
{
-/* struct fenced_domain domain;
- int rv;
-
- memset(&domain, 0, sizeof(domain));
-
- rv = fenced_domain_info(&domain);
- if (rv < 0)
- return rv;
-
- *count = domain.victim_count;
-*/
return 0;
}
diff --git a/dlm_controld/member.c b/dlm_controld/member.c
index 4a445c8..7af581c 100644
--- a/dlm_controld/member.c
+++ b/dlm_controld/member.c
@@ -265,7 +265,6 @@ static void shutdown_callback(corosync_cfg_handle_t h,
static corosync_cfg_callbacks_t cfg_callbacks =
{
.corosync_cfg_shutdown_callback = shutdown_callback,
- .corosync_cfg_state_track_callback = NULL,
};
void process_cluster_cfg(int ci)
@@ -302,9 +301,16 @@ int setup_cluster_cfg(void)
corosync_cfg_finalize(ch);
return -1;
}
+
our_nodeid = nodeid;
log_debug("our_nodeid %d", our_nodeid);
+ if (our_nodeid < 0) {
+ log_error("negative nodeid, set corosync totem.clear_node_high_bit");
+ corosync_cfg_finalize(ch);
+ return -1;
+ }
+
return fd;
}
diff --git a/init/dlm.init b/init/dlm.init
index db8f17f..7f3da2d 100644
--- a/init/dlm.init
+++ b/init/dlm.init
@@ -26,7 +26,7 @@ progdir="cluster"
lockfile="/var/run/$progdir/$prog.pid"
exec="/usr/sbin/$prog"
-[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+[ -f /etc/sysconfig/dlm ] && . /etc/sysconfig/dlm
setup() {
modprobe dlm > /dev/null 2>&1
diff --git a/init/dlm.service b/init/dlm.service
index e275843..d7cf9c7 100644
--- a/init/dlm.service
+++ b/init/dlm.service
@@ -4,7 +4,10 @@ After=syslog.target network.target corosync.service
[Service]
Type=forking
-ExecStart=/usr/sbin/dlm_controld $OPTIONS
+EnvironmentFile=/etc/sysconfig/dlm
+ExecStartPre=/sbin/modprobe dlm
+ExecStart=/usr/sbin/dlm_controld $DLM_CONTROLD_OPTS
+#ExecStopPost=/sbin/modprobe -r dlm
[Install]
WantedBy=multi-user.target
diff --git a/libdlm/51-dlm.rules b/libdlm/51-dlm.rules
index f71e79d..9d21fc0 100644
--- a/libdlm/51-dlm.rules
+++ b/libdlm/51-dlm.rules
@@ -1,5 +1,4 @@
-KERNEL=="dlm-control", NAME="misc/dlm-control", MODE="0666"
-KERNEL=="dlm-monitor", NAME="misc/dlm-monitor", MODE="0666"
-KERNEL=="dlm_default", NAME="misc/dlm_default", MODE="0666"
-KERNEL=="dlm_*", NAME="misc/%k", MODE="0660"
-
+KERNEL=="dlm-control", MODE="0666", SYMLINK+="misc/dlm-control"
+KERNEL=="dlm-monitor", MODE="0666", SYMLINK+="misc/dlm-monitor"
+KERNEL=="dlm_plock", MODE="0666", SYMLINK+="misc/dlm_plock"
+KERNEL=="dlm_*", MODE="0660", SYMLINK+="misc/%k"