[packages/dlm] Add dlm_stonith_{reboot,off} aliases

jajcus jajcus at pld-linux.org
Fri Nov 2 09:37:58 CET 2012


commit 97d51e0728de3e9fb5f2a01188d02059dffdff6f
Author: Jacek Konieczny <j.konieczny at eggsoft.pl>
Date:   Fri Nov 2 09:32:20 2012 +0100

    Add dlm_stonith_{reboot,off} aliases
    
    The standard dlm_stonith helper would fence nodes by turning
    them off only – that is not always desirable.
    
    dlm_stonith_off and dlm_stonith_reboot aliases have been added to
    specify the action explicitely without changing the original dlm_stonith
    behaviour.

 dlm.spec                 |  5 +++++
 dlm_stonith_reboot.patch | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
---
diff --git a/dlm.spec b/dlm.spec
index 10df3bd..258cf78 100644
--- a/dlm.spec
+++ b/dlm.spec
@@ -19,6 +19,7 @@ Patch2:		%{name}_stonith-build.patch
 Patch3:		%{name}-mem_init.patch
 Patch4:		%{name}-signals.patch
 Patch5:		0003-dlm_controld-remove-fence_all-from-cli.patch
+Patch6:		dlm_stonith_reboot.patch
 URL:		http://sources.redhat.com/cluster/dlm/
 BuildRequires:	corosync-devel
 %{?with_dlm_stonith:BuildRequires:	corosync-devel}
@@ -74,6 +75,7 @@ Pliki nagłówkowe i dokumentacja programisty dla DLM-a.
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
 
 %build
 %{__make} \
@@ -119,6 +121,9 @@ install -d $RPM_BUILD_ROOT{%{systemdunitdir},/etc/{rc.d/init.d,sysconfig}} \
 	LIBDIR=%{_libdir} \
 	MANDIR=%{_mandir} \
 	HDRDIR=%{_includedir}
+
+ln -s dlm_stonith $RPM_BUILD_ROOT%{_sbindir}/dlm_stonith_reboot
+ln -s dlm_stonith $RPM_BUILD_ROOT%{_sbindir}/dlm_stonith_off
 %endif
 
 install init/%{name}.service $RPM_BUILD_ROOT%{systemdunitdir}
diff --git a/dlm_stonith_reboot.patch b/dlm_stonith_reboot.patch
new file mode 100644
index 0000000..97d1ace
--- /dev/null
+++ b/dlm_stonith_reboot.patch
@@ -0,0 +1,32 @@
+diff -dur dlm-3.99.5.orig/fence/stonith_helper.c dlm-3.99.5/fence/stonith_helper.c
+--- dlm-3.99.5.orig/fence/stonith_helper.c	2012-11-02 09:29:05.000000000 +0100
++++ dlm-3.99.5/fence/stonith_helper.c	2012-11-02 09:28:51.000000000 +0100
+@@ -16,6 +16,7 @@
+ 
+ int nodeid;
+ uint64_t fail_time;
++int turn_off=1;
+ 
+ #define MAX_ARG_LEN 1024
+ 
+@@ -26,6 +27,11 @@
+ 	char val[MAX_ARG_LEN];
+ 	char c;
+ 	int rv;
++	int arg0_l;
++
++	arg0_l = strlen(argv[0]);
++	if (arg0_l>7 && !strcmp(argv[arg0_l-7], "_reboot")) turn_off=0;
++	else if (arg0_l>4 && !strcmp(argv[arg0_l-4], "_off")) turn_off=1;
+ 
+ 	if (argc > 1) {
+ 		while ((c = getopt(argc, argv, "n:t:")) != -1) {
+@@ -77,7 +83,7 @@
+ 	if (t >= fail_time)
+ 		return 0;
+ 
+-	rv = stonith_api_kick_helper(nodeid, 300, 1);
++	rv = stonith_api_kick_helper(nodeid, 300, turn_off);
+ 	if (rv) {
+ 		fprintf(stderr, "kick_helper error %d nodeid %d\n", rv, nodeid);
+ 		openlog("stonith_helper", LOG_CONS | LOG_PID, LOG_DAEMON);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/dlm.git/commitdiff/97d51e0728de3e9fb5f2a01188d02059dffdff6f



More information about the pld-cvs-commit mailing list