cluster: STABLE32 - cman init: reorder cmannotifyd startup and allow breakpoints to be configurable
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=c8b37b3f297...
Commit: c8b37b3f2971b76cd8ead80c23e02745126c9493
Parent: f841e032042f45bf978be6a53a1435ddca1f97c1
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Tue Aug 14 12:22:16 2012 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Aug 14 12:22:16 2012 +0200
cman init: reorder cmannotifyd startup and allow breakpoints to be configurable
users have requested for cmannotifyd to start earlier in the process
to be able to dispatch startup notifications.
also some users don't need many of the daemons in the stack at all
and only use cman for quorum. Allow the breakpoints to be configurable.
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
cman/init.d/cman.in | 26 +++++++++++++++++++++-----
cman/init.d/cman.init.defaults.in | 13 +++++++++++++
2 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
index 64d12de..e15144b 100644
--- a/cman/init.d/cman.in
+++ b/cman/init.d/cman.in
@@ -203,6 +203,19 @@ cman_join_opts+=" -D$CONFIG_VALIDATION"
# full - show everything
[ -z "$INITLOGLEVEL" ] && INITLOGLEVEL=terse
+# INITBREAKPOINT -- select cman init break point during startup
+# possible values:
+# setup - exit before executing cman
+# join - exit after executing cman
+# notify - exit after starting up notifyd (if enabled) and before quorum
+# quorum - exit after start qdiskd (if enabled) and wait for quorum
+# daemons - exit after starting all other daemons (if enabled)
+# all (default) - start all the stack
+#
+# invoking cman init with /etc/init.d/cman start <selected_breakpoint>
+# overrides configured breakpoint from default settings
+[ -z "$INITBREAKPOINT" ] && INITBREAKPOINT=""
+
### generic wrapper functions
ok() {
@@ -782,7 +795,8 @@ tune_dlm_hash_sizes()
start()
{
currentaction="start"
- breakpoint="$1"
+ [ -n "$INITBREAKPOINT" ] && breakpoint="$INITBREAKPOINT"
+ [ -n "$1" ] && breakpoint="$1"
sshd_enabled && cd @INITDDIR@ && ./sshd start
@@ -824,6 +838,12 @@ start()
[ "$breakpoint" = "join" ] && exit 0
+ runwrap start_cmannotifyd \
+ cmannotifyd_enabled \
+ "Starting cmannotifyd"
+
+ [ "$breakpoint" = "notify" ] && exit 0
+
runwrap start_qdiskd \
qdiskd_enabled \
"Starting qdiskd"
@@ -856,10 +876,6 @@ start()
ocfs2_enabled \
"Starting ocfs2_controld"
- runwrap start_cmannotifyd \
- cmannotifyd_enabled \
- "Starting cmannotifyd"
-
[ "$breakpoint" = "daemons" ] && exit 0
runwrap unfence_self \
diff --git a/cman/init.d/cman.init.defaults.in b/cman/init.d/cman.init.defaults.in
index 03b2474..4525d70 100644
--- a/cman/init.d/cman.init.defaults.in
+++ b/cman/init.d/cman.init.defaults.in
@@ -117,3 +117,16 @@
# terse (default) - show only required activity
# full - show everything
#INITLOGLEVEL=terse
+
+# INITBREAKPOINT -- select cman init break point during startup
+# possible values:
+# setup - exit before executing cman
+# join - exit after executing cman
+# notify - exit after starting up notifyd (if enabled) and before quorum
+# quorum - exit after start qdiskd (if enabled) and wait for quorum
+# daemons - exit after starting all other daemons (if enabled)
+# all (default) - start all the stack
+#
+# invoking cman init with /etc/init.d/cman start <selected_breakpoint>
+# overrides configured breakpoint from default settings
+#INITBREAKPOINT="all"
11 years, 8 months
cluster: STABLE32 - update .gitignore
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=f841e032042...
Commit: f841e032042f45bf978be6a53a1435ddca1f97c1
Parent: 6d6bf99b91ef62d8f095759d5c38cc9da85707e9
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Tue Aug 14 11:59:07 2012 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Aug 14 11:59:07 2012 +0200
update .gitignore
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
.gitignore | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index 97d6273..e171466 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,50 @@ make/defines.mk
*.so*
*.lcrso
*.pc
+bindings/perl/ccs/CCS.bs
+bindings/perl/ccs/CCS.c
+bindings/perl/ccs/CCS.pm
+bindings/perl/ccs/META.yml
+bindings/perl/ccs/MYMETA.yml
+bindings/perl/ccs/Makefile
+bindings/perl/ccs/blib/
+bindings/perl/ccs/pm_to_blib
+cman/cman_tool/cman_tool
+cman/init.d/cman
+cman/init.d/cman.init.defaults
+cman/notifyd/cman_notify
+cman/notifyd/cmannotifyd
+cman/qdisk/mkqdisk
+cman/qdisk/qdiskd
+config/tools/ccs_tool/ccs_test
+config/tools/ccs_tool/ccs_tool
+config/tools/ldap/confdb2ldif
+config/tools/ldap/rng2ldif/genclass
+config/tools/ldap/rng2ldif/rng2ldif
+config/tools/xml/ccs_config_dump
+config/tools/xml/ccs_config_validate
+config/tools/xml/ccs_update_schema
+config/tools/xml/cluster.rng
+dlm/tool/dlm_tool
+doc/cluster
+fence/fence_node/fence_node
+fence/fence_tool/fence_tool
+fence/fenced/fenced
+group/daemon/groupd
+group/dlm_controld/dlm_controld
+group/tool/group_tool
+rgmanager/init.d/cpglockd
+rgmanager/init.d/cpglockd.init.defaults
+rgmanager/init.d/rgmanager
+rgmanager/src/clulib/msgtest
+rgmanager/src/daemons/clurgmgrd
+rgmanager/src/daemons/cpglockd
+rgmanager/src/daemons/cpglockdump
+rgmanager/src/daemons/rg_test
+rgmanager/src/daemons/rgmanager
+rgmanager/src/utils/clubufflush
+rgmanager/src/utils/clufindhostname
+rgmanager/src/utils/clulog
+rgmanager/src/utils/clunfslock
+rgmanager/src/utils/clustat
+rgmanager/src/utils/clusvcadm
11 years, 8 months
cluster: STABLE32 - build: rename .d files to .Tpo and extend header tracking
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=6d6bf99b91e...
Commit: 6d6bf99b91ef62d8f095759d5c38cc9da85707e9
Parent: d6b5a4aa6eb261ebbf09ff778cd12deaf02c857d
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Tue Aug 14 11:48:52 2012 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Aug 14 11:48:52 2012 +0200
build: rename .d files to .Tpo and extend header tracking
.Tpo is slightly more standard (as used by autotools) for dependency
tracking.
this also allows to drop .d from .gitignore that was in conflict
with our init.d dirs (finally!)
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
.gitignore | 9 +--------
cman/cman_tool/Makefile | 2 +-
cman/daemon/Makefile | 4 ++--
cman/notifyd/Makefile | 2 +-
cman/qdisk/Makefile | 6 +++---
config/plugins/ldap/Makefile | 2 +-
config/plugins/xml/Makefile | 2 +-
config/tools/ccs_tool/Makefile | 2 +-
config/tools/ldap/Makefile | 2 +-
config/tools/ldap/rng2ldif/Makefile | 6 +++---
configure | 2 +-
dlm/tool/Makefile | 2 +-
fence/fence_node/Makefile | 2 +-
fence/fence_tool/Makefile | 2 +-
fence/fenced/Makefile | 2 +-
group/daemon/Makefile | 2 +-
group/dlm_controld/Makefile | 2 +-
make/clean.mk | 2 +-
make/libs.mk | 2 +-
rgmanager/src/clulib/Makefile | 4 ++--
rgmanager/src/daemons/Makefile | 6 +++---
rgmanager/src/utils/Makefile | 10 +++++-----
22 files changed, 34 insertions(+), 41 deletions(-)
diff --git a/.gitignore b/.gitignore
index 8b2a0ed..97d6273 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,15 +1,8 @@
make/defines.mk
.configure.sh
-*.d
*.o
+*.Tpo
*.a
*.so*
*.lcrso
-*.po
-.*.*o.cmd
-.tmp_versions
-*.ko
-Module.symvers
-modules.order
-*.mod.c
*.pc
diff --git a/cman/cman_tool/Makefile b/cman/cman_tool/Makefile
index 139ac52..77b48db 100644
--- a/cman/cman_tool/Makefile
+++ b/cman/cman_tool/Makefile
@@ -30,4 +30,4 @@ depends:
clean: generalclean
--include $(OBJS:.o=.d)
+-include $(OBJS:.o=.Tpo)
diff --git a/cman/daemon/Makefile b/cman/daemon/Makefile
index 1329de3..a2672e9 100644
--- a/cman/daemon/Makefile
+++ b/cman/daemon/Makefile
@@ -37,5 +37,5 @@ depends:
clean: generalclean
--include $(OBJS1:.o=.d)
--include $(OBJS2:.o=.d)
+-include $(OBJS1:.o=.Tpo)
+-include $(OBJS2:.o=.Tpo)
diff --git a/cman/notifyd/Makefile b/cman/notifyd/Makefile
index b2e5114..5676fe3 100644
--- a/cman/notifyd/Makefile
+++ b/cman/notifyd/Makefile
@@ -34,4 +34,4 @@ depends:
clean: generalclean
--include $(OBJS1:.o=.d)
+-include $(OBJS1:.o=.Tpo)
diff --git a/cman/qdisk/Makefile b/cman/qdisk/Makefile
index e3bb5f7..f39c036 100644
--- a/cman/qdisk/Makefile
+++ b/cman/qdisk/Makefile
@@ -47,6 +47,6 @@ depends:
clean: generalclean
--include $(OBJS1:.o=.d)
--include $(OBJS2:.o=.d)
--include $(SHAREDOBJS:.o=.d)
+-include $(OBJS1:.o=.Tpo)
+-include $(OBJS2:.o=.Tpo)
+-include $(SHAREDOBJS:.o=.Tpo)
diff --git a/config/plugins/ldap/Makefile b/config/plugins/ldap/Makefile
index 33e907d..c8621ad 100644
--- a/config/plugins/ldap/Makefile
+++ b/config/plugins/ldap/Makefile
@@ -27,4 +27,4 @@ ${TARGET}: ${OBJS}
clean: generalclean
--include $(OBJS:.o=.d)
+-include $(OBJS:.o=.Tpo)
diff --git a/config/plugins/xml/Makefile b/config/plugins/xml/Makefile
index abc5b75..8853317 100644
--- a/config/plugins/xml/Makefile
+++ b/config/plugins/xml/Makefile
@@ -24,4 +24,4 @@ ${TARGET}: ${OBJS}
clean: generalclean
--include $(OBJS:.o=.d)
+-include $(OBJS:.o=.Tpo)
diff --git a/config/tools/ccs_tool/Makefile b/config/tools/ccs_tool/Makefile
index 7ebb24a..223a41f 100644
--- a/config/tools/ccs_tool/Makefile
+++ b/config/tools/ccs_tool/Makefile
@@ -36,4 +36,4 @@ depends:
clean: generalclean
--include $(OBJS:.o=.d)
+-include $(OBJS:.o=.Tpo)
diff --git a/config/tools/ldap/Makefile b/config/tools/ldap/Makefile
index f58c788..1f0da3f 100644
--- a/config/tools/ldap/Makefile
+++ b/config/tools/ldap/Makefile
@@ -27,4 +27,4 @@ ${TARGET}: ${OBJS}
clean: generalclean
--include $(OBJS:.o=.d)
+-include $(OBJS:.o=.Tpo)
diff --git a/config/tools/ldap/rng2ldif/Makefile b/config/tools/ldap/rng2ldif/Makefile
index 75a2b03..54e7556 100644
--- a/config/tools/ldap/rng2ldif/Makefile
+++ b/config/tools/ldap/rng2ldif/Makefile
@@ -41,6 +41,6 @@ ldif-update: all $(SRCDIR)/config/plugins/ldap/ldap-base.csv
clean: generalclean
--include $(OBJS1:.o=.d)
--include $(OBJS2:.o=.d)
--include $(SHAREDOBJS:.o=.d)
+-include $(OBJS1:.o=.Tpo)
+-include $(OBJS2:.o=.Tpo)
+-include $(SHAREDOBJS:.o=.Tpo)
diff --git a/configure b/configure
index 4e9bc2a..1e6356e 100755
--- a/configure
+++ b/configure
@@ -317,7 +317,7 @@ if (!$cflags) {
} else {
$cflags="${cflags} -O0 -DDEBUG";
}
- $cflags="${cflags} -ggdb3 -MMD";
+ $cflags="${cflags} -ggdb3 -MD -MP -MF \$<.Tpo";
}
if ($extracflags) {
$cflags="${cflags} ${extracflags}";
diff --git a/dlm/tool/Makefile b/dlm/tool/Makefile
index 9d75b6c..680cc88 100644
--- a/dlm/tool/Makefile
+++ b/dlm/tool/Makefile
@@ -29,4 +29,4 @@ depends:
$(MAKE) -C ../libdlm all
$(MAKE) -C ../libdlmcontrol all
--include $(OBJS:.o=.d)
+-include $(OBJS:.o=.Tpo)
diff --git a/fence/fence_node/Makefile b/fence/fence_node/Makefile
index 9b79449..665dd62 100644
--- a/fence/fence_node/Makefile
+++ b/fence/fence_node/Makefile
@@ -32,4 +32,4 @@ depends:
clean: generalclean
--include $(OBJS:.o=.d)
+-include $(OBJS:.o=.Tpo)
diff --git a/fence/fence_tool/Makefile b/fence/fence_tool/Makefile
index dab3e8f..92152fd 100644
--- a/fence/fence_tool/Makefile
+++ b/fence/fence_tool/Makefile
@@ -29,4 +29,4 @@ depends:
clean: generalclean
--include $(OBJS:.o=.d)
+-include $(OBJS:.o=.Tpo)
diff --git a/fence/fenced/Makefile b/fence/fenced/Makefile
index 902c299..6935475 100644
--- a/fence/fenced/Makefile
+++ b/fence/fenced/Makefile
@@ -46,4 +46,4 @@ depends:
clean: generalclean
--include $(OBJS:.o=.d)
+-include $(OBJS:.o=.Tpo)
diff --git a/group/daemon/Makefile b/group/daemon/Makefile
index 36268db..b1a98c5 100644
--- a/group/daemon/Makefile
+++ b/group/daemon/Makefile
@@ -32,4 +32,4 @@ ${TARGET}: ${OBJS}
clean: generalclean
--include $(OBJS:.o=.d)
+-include $(OBJS:.o=.Tpo)
diff --git a/group/dlm_controld/Makefile b/group/dlm_controld/Makefile
index bb5c82e..39c2b74 100644
--- a/group/dlm_controld/Makefile
+++ b/group/dlm_controld/Makefile
@@ -49,4 +49,4 @@ depends:
clean: generalclean
--include $(OBJS:.o=.d)
+-include $(OBJS:.o=.Tpo)
diff --git a/make/clean.mk b/make/clean.mk
index 3b66280..9f81fdd 100644
--- a/make/clean.mk
+++ b/make/clean.mk
@@ -1,5 +1,5 @@
generalclean:
- rm -rf *~* *.o *.a *.so *.so.* a.out *.po *.s *.d *.pyc
+ rm -rf *~* *.o *.a *.so *.so.* a.out *.po *.s *.Tpo *.pyc
rm -rf core core.* .depend cscope.* *.orig *.rej
rm -rf linux .*.o.cmd .*.ko.cmd *.mod.c .tmp_versions
rm -rf Module.symvers Module.markers .*.o.d modules.order
diff --git a/make/libs.mk b/make/libs.mk
index 0cd8e82..a4e9a12 100644
--- a/make/libs.mk
+++ b/make/libs.mk
@@ -56,4 +56,4 @@ $(STATICLIB): $(OBJS)
clean: generalclean
--include $(OBJS:.o=.d)
+-include $(OBJS:.o=.Tpo)
diff --git a/rgmanager/src/clulib/Makefile b/rgmanager/src/clulib/Makefile
index adb5578..f14acd9 100644
--- a/rgmanager/src/clulib/Makefile
+++ b/rgmanager/src/clulib/Makefile
@@ -37,5 +37,5 @@ ${TARGET2}: ${OBJS2} ${TARGET1}
clean: generalclean
--include $(OBJS1:.o=.d)
--include $(OBJS2:.o=.d)
+-include $(OBJS1:.o=.Tpo)
+-include $(OBJS2:.o=.Tpo)
diff --git a/rgmanager/src/daemons/Makefile b/rgmanager/src/daemons/Makefile
index 43d3377..83bdf93 100644
--- a/rgmanager/src/daemons/Makefile
+++ b/rgmanager/src/daemons/Makefile
@@ -132,6 +132,6 @@ depends:
clean: generalclean
rm -f tests/*.out*
--include $(OBJS1:.o=.d)
--include $(OBJS2:.o=.d)
--include $(OBJS3:.o=.d)
+-include $(OBJS1:.o=.Tpo)
+-include $(OBJS2:.o=.Tpo)
+-include $(OBJS3:.o=.Tpo)
diff --git a/rgmanager/src/utils/Makefile b/rgmanager/src/utils/Makefile
index b2073c3..390fe76 100644
--- a/rgmanager/src/utils/Makefile
+++ b/rgmanager/src/utils/Makefile
@@ -66,8 +66,8 @@ depends:
clean: generalclean
--include $(OBJS1:.o=.d)
--include $(OBJS2:.o=.d)
--include $(OBJS3:.o=.d)
--include $(OBJS4:.o=.d)
--include $(OBJS5:.o=.d)
+-include $(OBJS1:.o=.Tpo)
+-include $(OBJS2:.o=.Tpo)
+-include $(OBJS3:.o=.Tpo)
+-include $(OBJS4:.o=.Tpo)
+-include $(OBJS5:.o=.Tpo)
11 years, 8 months
cluster: STABLE32 - Use new corosync confdb API to remove string limit.
by Christine Caulfield
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=d6b5a4aa6eb...
Commit: d6b5a4aa6eb261ebbf09ff778cd12deaf02c857d
Parent: b8b42d0d84a895490116ef08bd97733697e5e417
Author: Christine Caulfield <ccaulfie(a)redhat.com>
AuthorDate: Tue Aug 14 09:13:06 2012 +0100
Committer: Christine Caulfield <ccaulfie(a)redhat.com>
CommitterDate: Tue Aug 14 09:13:06 2012 +0100
Use new corosync confdb API to remove string limit.
The original corosync confdb API had a 256 byte limit on all
value strings returned. A new API was added that did not have this
restriction, and this commit cases (mainly) libccs and others to
use it so those benefits can be passed down to other cluster
services.
This means that cluster will now only compile against
corosync libraries that have the *_typed2 API calls.
rhbz#847234
Signed-off-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/cman_tool/main.c | 11 +++---
config/libs/libccsconfdb/fullxpath.c | 22 ++++++++----
config/libs/libccsconfdb/xpathlite.c | 59 ++++++++++++++++++++++------------
config/tools/ldap/confdb2ldif.c | 15 +++++---
config/tools/xml/ccs_config_dump.c | 17 ++++++----
5 files changed, 77 insertions(+), 47 deletions(-)
diff --git a/cman/cman_tool/main.c b/cman/cman_tool/main.c
index b0a2116..5596698 100644
--- a/cman/cman_tool/main.c
+++ b/cman/cman_tool/main.c
@@ -704,9 +704,9 @@ static int get_config_variables(commandline_t *comline, char **config_modules)
int res;
int got_iface = 1;
char key_name[1024];
- size_t key_name_len;
- char key_value[1024];
+ char *key_value = NULL;
size_t key_value_len;
+ confdb_value_types_t type;
hdb_handle_t confdb_handle;
hdb_handle_t cmanp_handle;
confdb_callbacks_t callbacks = {
@@ -732,9 +732,8 @@ static int get_config_variables(commandline_t *comline, char **config_modules)
if (res != CS_OK)
goto finish;
- while ( (res = confdb_key_iter(confdb_handle, cmanp_handle, key_name, &key_name_len,
- key_value, &key_value_len)) == CS_OK) {
- key_name[key_name_len] = '\0';
+ while ( (res = confdb_key_iter_typed2(confdb_handle, cmanp_handle, key_name,
+ (void**)&key_value, &key_value_len, &type)) == CS_OK) {
key_value[key_value_len] = '\0';
setenv(key_name, key_value, 1);
@@ -742,6 +741,8 @@ static int get_config_variables(commandline_t *comline, char **config_modules)
*config_modules = strdup(key_value);
got_iface = 0;
}
+ free(key_value);
+ key_value = NULL;
}
finish:
diff --git a/config/libs/libccsconfdb/fullxpath.c b/config/libs/libccsconfdb/fullxpath.c
index 8c4501f..bffb9c3 100644
--- a/config/libs/libccsconfdb/fullxpath.c
+++ b/config/libs/libccsconfdb/fullxpath.c
@@ -52,8 +52,9 @@ static int dump_objdb_buff(confdb_handle_t dump_handle, hdb_handle_t cluster_han
char temp[PATH_MAX];
char object_name[PATH_MAX];
char key_name[PATH_MAX];
- char key_value[PATH_MAX];
- size_t key_value_len = 0, key_name_len = 0, object_name_len = 0;
+ char *key_value = NULL;
+ size_t key_value_len = 0, object_name_len = 0;
+ confdb_value_types_t type;
int res;
res = confdb_key_iter_start(dump_handle, parent_object_handle);
@@ -70,16 +71,17 @@ static int dump_objdb_buff(confdb_handle_t dump_handle, hdb_handle_t cluster_han
}
while ((res =
- confdb_key_iter(dump_handle, parent_object_handle, key_name,
- &key_name_len, key_value,
- &key_value_len)) == CS_OK) {
+ confdb_key_iter_typed2(dump_handle, parent_object_handle, key_name,
+ (void **)&key_value,
+ &key_value_len, &type)) == CS_OK) {
int char_pos = 0;
- key_name[key_name_len] = '\0';
key_value[key_value_len] = '\0';
snprintf(temp, PATH_MAX - 1, " %s=\"", key_name);
- if (add_to_buffer(temp, buffer, bufsize))
+ if (add_to_buffer(temp, buffer, bufsize)) {
+ free(key_value);
return -1;
+ }
for (char_pos = 0; char_pos < key_value_len-1; char_pos++) {
switch (key_value[char_pos]) {
@@ -104,9 +106,13 @@ static int dump_objdb_buff(confdb_handle_t dump_handle, hdb_handle_t cluster_han
temp[1] = '\0';
break;
}
- if (add_to_buffer(temp, buffer, bufsize))
+ if (add_to_buffer(temp, buffer, bufsize)) {
+ free(key_value);
return -1;
+ }
}
+ free(key_value);
+ key_value = NULL;
snprintf(temp, PATH_MAX - 1, "\"");
if (add_to_buffer(temp, buffer, bufsize))
diff --git a/config/libs/libccsconfdb/xpathlite.c b/config/libs/libccsconfdb/xpathlite.c
index 710c176..db986e3 100644
--- a/config/libs/libccsconfdb/xpathlite.c
+++ b/config/libs/libccsconfdb/xpathlite.c
@@ -69,6 +69,7 @@ static int path_dive(confdb_handle_t handle, hdb_handle_t *query_handle,
char *pos = NULL, *next = NULL;
int i;
hdb_handle_t new_obj_handle;
+ confdb_value_types_t type;
pos = current_query + 1;
@@ -98,6 +99,8 @@ static int path_dive(confdb_handle_t handle, hdb_handle_t *query_handle,
*/
char *start = NULL, *middle = NULL, *end = NULL;
+ char *key_value = NULL;
+ size_t valuelen;
char data[PATH_MAX];
size_t datalen = 0;
@@ -201,17 +204,22 @@ static int path_dive(confdb_handle_t handle, hdb_handle_t *query_handle,
&new_obj_handle) != CS_OK)
goto fail;
else {
- if (confdb_key_get
+ key_value = NULL;
+ if (confdb_key_get_typed2
(handle, new_obj_handle,
- middle, strlen(middle),
- data,
- &datalen) == CS_OK) {
+ middle,
+ (void **) &key_value,
+ &valuelen, &type) == CS_OK) {
if (!strcmp
- (data, value))
+ (key_value, value))
goout = 1;
+ free(key_value);
+ key_value = NULL;
}
}
}
+ free(key_value);
+ key_value = NULL;
confdb_object_find_destroy(handle,
*query_handle);
*query_handle = new_obj_handle;
@@ -234,15 +242,14 @@ static int get_data(confdb_handle_t handle, hdb_handle_t connection_handle,
{
int cmp;
char data[PATH_MAX];
- char resval[PATH_MAX];
- char keyval[PATH_MAX];
+ char *resval;
+ char *keyval;
hdb_handle_t new_obj_handle;
unsigned int value = 0;
+ confdb_value_types_t type;
size_t datalen = 0, keyvallen = PATH_MAX;
memset(data, 0, PATH_MAX);
- memset(resval, 0, PATH_MAX);
- memset(keyval, 0, PATH_MAX);
// we need to handle child::*[int value] in non list mode.
cmp = strcmp(curpos, "child::*");
@@ -293,8 +300,11 @@ static int get_data(confdb_handle_t handle, hdb_handle_t connection_handle,
value--;
}
- snprintf(resval, sizeof(resval), "%s=%s", data, keyval);
- *rtn = strndup(resval, datalen + keyvallen + 2);
+ resval = malloc(datalen + keyvallen + 2);
+ if (!resval)
+ goto fail;
+ snprintf(resval, datalen + keyvallen + 2, "%s=%s", data, keyval);
+ *rtn = resval;
} else if (!strncmp(curpos, "@*", strlen("@*"))) {
@@ -314,18 +324,24 @@ static int get_data(confdb_handle_t handle, hdb_handle_t connection_handle,
while (value != 0) {
memset(data, 0, PATH_MAX);
- if (confdb_key_iter
- (handle, query_handle, data, &datalen, keyval,
- &keyvallen) != CS_OK) {
+ keyval = NULL;
+ if (confdb_key_iter_typed2
+ (handle, query_handle, data, (void **)&keyval,
+ &keyvallen, &type) != CS_OK) {
reset_iterator(handle, connection_handle);
goto fail;
}
value--;
+ if (value != 0)
+ free(keyval);
}
-
- snprintf(resval, sizeof(resval), "%s=%s", data, keyval);
- *rtn = strndup(resval, datalen + keyvallen + 2);
+ resval = malloc(datalen + keyvallen + 2);
+ if (!resval)
+ goto fail;
+ snprintf(resval, datalen + keyvallen + 2, "%s=%s", data, keyval);
+ *rtn = resval;
+ free(keyval);
} else { /* pure data request */
char *query;
@@ -343,12 +359,13 @@ static int get_data(confdb_handle_t handle, hdb_handle_t connection_handle,
query = query + 1;
- if (confdb_key_get
- (handle, query_handle, query, strlen(query), data,
- &datalen) != CS_OK)
+ keyval = NULL;
+ if (confdb_key_get_typed2
+ (handle, query_handle, query, (void **)&keyval,
+ &keyvallen, &type) != CS_OK)
goto fail;
- *rtn = strndup(data, datalen);
+ *rtn = keyval;
}
return 0;
diff --git a/config/tools/ldap/confdb2ldif.c b/config/tools/ldap/confdb2ldif.c
index 1f83c2f..8ab45b5 100644
--- a/config/tools/ldap/confdb2ldif.c
+++ b/config/tools/ldap/confdb2ldif.c
@@ -41,8 +41,8 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object
char object_name[1024];
size_t object_name_len;
char key_name[1024];
- size_t key_name_len;
- char key_value[1024];
+ char *key_value=NULL;
+ confdb_value_types_t type;
size_t key_value_len;
char cumulative_dn[4096];
int res;
@@ -57,13 +57,14 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object
return;
}
- while ( (res = confdb_key_iter(handle, parent_object_handle, key_name, &key_name_len,
- key_value, &key_value_len)) == CS_OK) {
- key_name[key_name_len] = '\0';
+ while ( (res = confdb_key_iter_typed2(handle, parent_object_handle, key_name,
+ (void**)&key_value, &key_value_len, &type)) == CS_OK) {
key_value[key_value_len] = '\0';
printf("%s: %s\n", ldap_attr_name(key_name), key_value);
keycount++;
+ free(key_value);
+ key_value=NULL;
}
if (strncmp(fulldn, "cn=", 3) == 0) {
printf("cn: %s\n", dn);
@@ -97,7 +98,7 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object
object_name[object_name_len] = '\0';
/* Check for "name", and create dummy parent object */
- res = confdb_key_get(handle, object_handle, "name", strlen("name"), key_value, &key_value_len);
+ res = confdb_key_get_typed2(handle, object_handle, "name", (void **)&key_value, &key_value_len, &type);
if (res == CS_OK) {
snprintf(cumulative_dn, sizeof(cumulative_dn) - 1, "cn=%s,%s", object_name, fulldn);
printf("\n");
@@ -106,6 +107,8 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object
printf("objectclass: %s\n", "nsContainer");
snprintf(cumulative_dn, sizeof(cumulative_dn) - 1, "name=%s,cn=%s,%s", key_value, object_name, fulldn);
+ free(key_value);
+ key_value = NULL;
}
else {
snprintf(cumulative_dn, sizeof(cumulative_dn) - 1, "cn=%s,%s", object_name, fulldn);
diff --git a/config/tools/xml/ccs_config_dump.c b/config/tools/xml/ccs_config_dump.c
index 022777f..165257d 100644
--- a/config/tools/xml/ccs_config_dump.c
+++ b/config/tools/xml/ccs_config_dump.c
@@ -14,20 +14,21 @@ static int dump_objdb_buff(confdb_handle_t dump_handle, hdb_handle_t cluster_han
hdb_handle_t parent_object_handle, int level)
{
hdb_handle_t object_handle;
- char object_name[PATH_MAX], key_name[PATH_MAX], key_value[PATH_MAX];
- size_t key_value_len = 0, key_name_len = 0, object_name_len = 0;
+ char object_name[PATH_MAX], key_name[PATH_MAX];
+ char *key_value=NULL;
+ size_t key_value_len = 0, object_name_len = 0;
int current_level = level+1;
int has_children = 0;
+ confdb_value_types_t type;
if (confdb_key_iter_start(dump_handle, parent_object_handle) != CS_OK)
return -1;
- while (confdb_key_iter(dump_handle, parent_object_handle, key_name,
- &key_name_len, key_value,
- &key_value_len) == CS_OK) {
+ while (confdb_key_iter_typed2(dump_handle, parent_object_handle, key_name,
+ (void**)&key_value,
+ &key_value_len, &type) == CS_OK) {
int char_pos = 0;
- key_name[key_name_len] = '\0';
key_value[key_value_len] = '\0';
printf(" %s=\"", key_name);
for (char_pos = 0; char_pos < key_value_len-1; char_pos++) {
@@ -54,6 +55,8 @@ static int dump_objdb_buff(confdb_handle_t dump_handle, hdb_handle_t cluster_han
}
}
printf("\"");
+ free(key_value);
+ key_value = NULL;
}
if (confdb_object_iter_start(dump_handle, parent_object_handle) != CS_OK)
@@ -61,7 +64,7 @@ static int dump_objdb_buff(confdb_handle_t dump_handle, hdb_handle_t cluster_han
while (confdb_object_iter(dump_handle, parent_object_handle,
&object_handle, object_name,
- &object_name_len) == CS_OK) {
+ &object_name_len) == CS_OK) {
hdb_handle_t parent;
int i;
int found_children;
11 years, 8 months
cluster: RHEL59 - qdiskd: backport dual socket connection to cman
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=25eebc0689b...
Commit: 25eebc0689b97ffaa32cf43a59f4c8db8819a9cd
Parent: 409112bc764b8ea27fcdf57668ebd5225a6c0f8b
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Mon Aug 13 13:59:33 2012 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Mon Aug 13 15:50:39 2012 +0200
qdiskd: backport dual socket connection to cman
Patch 76741bb2a94ae94e493c609d50f570d02e2f3029 had a not so obvious
dependency on 08ae3ce147b2771c5ee6e1d364a5e48c88384427.
Backport portion of 08ae3ce147b2771c5ee6e1d364a5e48c88384427 to handle
dual cman socket (admin and user) and use the correct socket (user)
for send/receive data.
Move cman_alive check and heartbeat (for dispatch) to ch_user.
Resolves: rhbz#782900
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
Acked-by: Lon Hohberger <lhh(a)redhat.com>
---
cman/qdisk/disk.h | 5 ++-
cman/qdisk/disk_util.c | 7 +++--
cman/qdisk/iostate.c | 8 +++---
cman/qdisk/main.c | 71 ++++++++++++++++++++++-------------------------
4 files changed, 44 insertions(+), 47 deletions(-)
diff --git a/cman/qdisk/disk.h b/cman/qdisk/disk.h
index d491de1..83167ea 100644
--- a/cman/qdisk/disk.h
+++ b/cman/qdisk/disk.h
@@ -270,7 +270,8 @@ typedef struct {
int qc_master; /* Master?! */
int qc_status_sock;
run_flag_t qc_flags;
- cman_handle_t qc_ch;
+ cman_handle_t qc_ch_admin;
+ cman_handle_t qc_ch_user;
char *qc_device;
char *qc_label;
char *qc_status_file;
@@ -299,7 +300,7 @@ typedef struct {
int qd_write_status(qd_ctx *ctx, int nid, disk_node_state_t state,
disk_msg_t *msg, memb_mask_t mask, memb_mask_t master);
int qd_read_print_status(target_info_t *disk, int nid);
-int qd_init(qd_ctx *ctx, cman_handle_t ch, int me);
+int qd_init(qd_ctx *ctx, cman_handle_t ch_admin, cman_handle_t ch_user, int me);
void qd_destroy(qd_ctx *ctx);
/* proc.c */
diff --git a/cman/qdisk/disk_util.c b/cman/qdisk/disk_util.c
index f5539c0..25f4013 100644
--- a/cman/qdisk/disk_util.c
+++ b/cman/qdisk/disk_util.c
@@ -312,16 +312,17 @@ generate_token(void)
Initialize a quorum disk context, given a CMAN handle and a nodeid.
*/
int
-qd_init(qd_ctx *ctx, cman_handle_t ch, int me)
+qd_init(qd_ctx *ctx, cman_handle_t ch_admin, cman_handle_t ch_user, int me)
{
- if (!ctx || !ch || !me) {
+ if (!ctx || !ch_admin || !ch_user || !me) {
errno = EINVAL;
return -1;
}
memset(ctx, 0, sizeof(*ctx));
ctx->qc_incarnation = generate_token();
- ctx->qc_ch = ch;
+ ctx->qc_ch_admin = ch_admin;
+ ctx->qc_ch_user = ch_user;
ctx->qc_my_id = me;
ctx->qc_status_sock = -1;
diff --git a/cman/qdisk/iostate.c b/cman/qdisk/iostate.c
index eb74ad2..ba7ad12 100644
--- a/cman/qdisk/iostate.c
+++ b/cman/qdisk/iostate.c
@@ -69,7 +69,7 @@ io_nanny_thread(void *arg)
iostate_t last_main_state = 0, current_main_state = 0;
int last_main_incarnation = 0, current_main_incarnation = 0;
int logged_incarnation = 0;
- cman_handle_t ch = (cman_handle_t)arg;
+ cman_handle_t ch_user = (cman_handle_t)arg;
int32_t whine_state;
/* Start with wherever we're at now */
@@ -105,7 +105,7 @@ io_nanny_thread(void *arg)
/* Whine on CMAN api */
whine_state = (int32_t)current_main_state;
swab32(whine_state);
- cman_send_data(ch, &whine_state, sizeof(int32_t), 0, CLUSTER_PORT_QDISKD, 0);
+ cman_send_data(ch_user, &whine_state, sizeof(int32_t), 0, CLUSTER_PORT_QDISKD, 0);
/* Don't log things twice */
if (logged_incarnation == current_main_incarnation)
@@ -125,7 +125,7 @@ io_nanny_thread(void *arg)
int
-io_nanny_start(cman_handle_t ch, int timeout)
+io_nanny_start(cman_handle_t ch_user, int timeout)
{
int ret;
@@ -135,7 +135,7 @@ io_nanny_start(cman_handle_t ch, int timeout)
qdisk_timeout = timeout;
thread_active = 1;
- ret = pthread_create(&io_nanny_tid, NULL, io_nanny_thread, ch);
+ ret = pthread_create(&io_nanny_tid, NULL, io_nanny_thread, ch_user);
pthread_mutex_unlock(&state_mutex);
return ret;
diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c
index 90d00ab..1873a05 100644
--- a/cman/qdisk/main.c
+++ b/cman/qdisk/main.c
@@ -287,7 +287,7 @@ check_transitions(qd_ctx *ctx, node_info_t *ni, int max, memb_mask_t mask)
if (ctx->qc_flags & RF_ALLOW_KILL) {
clulog(LOG_DEBUG, "Telling CMAN to "
"kill the node\n");
- cman_kill_node(ctx->qc_ch,
+ cman_kill_node(ctx->qc_ch_admin,
ni[x].ni_status.ps_nodeid);
}
}
@@ -325,7 +325,7 @@ check_transitions(qd_ctx *ctx, node_info_t *ni, int max, memb_mask_t mask)
if (ctx->qc_flags & RF_ALLOW_KILL) {
clulog(LOG_DEBUG, "Telling CMAN to "
"kill the node\n");
- cman_kill_node(ctx->qc_ch,
+ cman_kill_node(ctx->qc_ch_admin,
ni[x].ni_status.ps_nodeid);
}
continue;
@@ -580,7 +580,7 @@ check_cman(qd_ctx *ctx, memb_mask_t mask, memb_mask_t master_mask)
cman_node_t nodes[MAX_NODES_DISK];
int retnodes, x;
- if (cman_get_nodes(ctx->qc_ch, MAX_NODES_DISK,
+ if (cman_get_nodes(ctx->qc_ch_admin, MAX_NODES_DISK,
&retnodes, nodes) <0 )
return;
@@ -894,7 +894,7 @@ quorum_loop(qd_ctx *ctx, node_info_t *ni, int max)
_running = 1;
while (_running) {
/* perform a forceful cman dispatch */
- if (cman_alive(ctx->qc_ch) < 0) {
+ if (cman_alive(ctx->qc_ch_user) < 0) {
clulog(LOG_ERR, "cman: %s\n", strerror(errno));
}
@@ -931,11 +931,11 @@ quorum_loop(qd_ctx *ctx, node_info_t *ni, int max)
msg.m_msg = M_NONE;
++msg.m_seq;
bid_pending = 0;
- if (cman_alive(ctx->qc_ch) < 0) {
+ if (cman_alive(ctx->qc_ch_user) < 0) {
clulog(LOG_ERR, "cman: %s\n",
strerror(errno));
} else {
- cman_poll_quorum_device(ctx->qc_ch, 0);
+ cman_poll_quorum_device(ctx->qc_ch_admin, 0);
}
if (ctx->qc_flags & RF_REBOOT)
reboot(RB_AUTOBOOT);
@@ -1039,7 +1039,7 @@ quorum_loop(qd_ctx *ctx, node_info_t *ni, int max)
/* We are the master. Poll the quorum device.
We can't be the master unless we score high
enough on our heuristics. */
- if (cman_alive(ctx->qc_ch) < 0) {
+ if (cman_alive(ctx->qc_ch_user) < 0) {
clulog(LOG_ERR, "cman_dispatch: %s\n",
strerror(errno));
clulog(LOG_ERR,
@@ -1048,7 +1048,7 @@ quorum_loop(qd_ctx *ctx, node_info_t *ni, int max)
}
check_cman(ctx, mask, master_mask);
if (!errors)
- cman_poll_quorum_device(ctx->qc_ch, 1);
+ cman_poll_quorum_device(ctx->qc_ch_admin, 1);
} else if (ctx->qc_status == S_RUN && ctx->qc_master &&
ctx->qc_master != ctx->qc_my_id) {
@@ -1060,7 +1060,7 @@ quorum_loop(qd_ctx *ctx, node_info_t *ni, int max)
ni[ctx->qc_master-1].ni_status.ps_master_mask,
ctx->qc_my_id-1,
sizeof(memb_mask_t))) {
- if (cman_alive(ctx->qc_ch) < 0) {
+ if (cman_alive(ctx->qc_ch_user) < 0) {
clulog(LOG_ERR, "cman_dispatch: %s\n",
strerror(errno));
clulog(LOG_ERR,
@@ -1069,7 +1069,7 @@ quorum_loop(qd_ctx *ctx, node_info_t *ni, int max)
}
if (!errors &&
(!(ctx->qc_flags & RF_MASTER_WINS)))
- cman_poll_quorum_device(ctx->qc_ch, 1);
+ cman_poll_quorum_device(ctx->qc_ch_admin, 1);
}
}
@@ -1506,12 +1506,7 @@ check_stop_cman(qd_ctx *ctx)
clulog(LOG_WARNING, "Telling CMAN to leave the cluster; qdisk is not"
" available\n");
-#if (defined(LIBCMAN_VERSION) && LIBCMAN_VERSION >= 2)
- if (cman_shutdown(ctx->qc_ch, 0) < 0) {
-#else
- int x = 0;
- if (ioctl(cman_get_fd(ctx->qc_ch), SIOCCLUSTER_LEAVE_CLUSTER, &x) < 0) {
-#endif
+ if (cman_shutdown(ctx->qc_ch_admin, 0) < 0) {
clulog(LOG_CRIT, "Could not leave the cluster - rebooting\n");
sleep(5);
if (ctx->qc_flags & RF_DEBUG)
@@ -1540,7 +1535,7 @@ qdisk_whine(cman_handle_t h, void *privdata, char *buf, int len,
swab32(dstate);
if (dstate) {
- clulog(LOG_CRIT, "qdiskd on node %d reports hung %s()\n",
+ clulog(LOG_CRIT, "qdiskd on node %d reports hung %s()\n", nodeid,
state_to_string(dstate));
ni[nodeid-1].ni_misses = 0;
}
@@ -1552,7 +1547,8 @@ main(int argc, char **argv)
cman_node_t me;
int cfh, rv, forked = 0, nfd = -1, ret = -1;
qd_ctx ctx;
- cman_handle_t ch = NULL;
+ cman_handle_t ch_admin = NULL;
+ cman_handle_t ch_user = NULL;
node_info_t ni[MAX_NODES_DISK];
struct h_data h[10];
char debug = 0, foreground = 0;
@@ -1597,12 +1593,8 @@ main(int argc, char **argv)
qp.ni = &ni[0];
qp.ni_len = MAX_NODES_DISK;
-#if (defined(LIBCMAN_VERSION) && LIBCMAN_VERSION >= 2)
- ch = cman_admin_init(&qp);
-#else
- ch = cman_init(&qp);
-#endif
- if (!ch) {
+ ch_admin = cman_admin_init(&qp);
+ if (!ch_admin) {
if (!foreground && !forked) {
if (daemon_init(argv[0]) < 0)
goto out;
@@ -1614,22 +1606,24 @@ main(int argc, char **argv)
do {
sleep(5);
-#if (defined(LIBCMAN_VERSION) && LIBCMAN_VERSION >= 2)
- ch = cman_admin_init(&qp);
-#else
- ch = cman_init(&qp);
-#endif
- } while (!ch);
+ ch_admin = cman_admin_init(&qp);
+ } while (!ch_admin);
+ }
+
+ ch_user = cman_init(&qp);
+ if (!ch_user) {
+ clulog_and_print(LOG_CRIT, "Could not register with CMAN: %s\n", strerror(errno));
+ goto out;
}
- if (cman_start_recv_data(ch, qdisk_whine, CLUSTER_PORT_QDISKD) != 0) {
+ if (cman_start_recv_data(ch_user, qdisk_whine, CLUSTER_PORT_QDISKD) != 0) {
clulog_and_print(LOG_CRIT, "Could not register with CMAN: %s\n",
strerror(errno));
goto out;
}
memset(&me, 0, sizeof(me));
- while (cman_get_node(ch, CMAN_NODEID_US, &me) < 0) {
+ while (cman_get_node(ch_admin, CMAN_NODEID_US, &me) < 0) {
if (!foreground && !forked) {
if (daemon_init(argv[0]) < 0)
goto out;
@@ -1639,7 +1633,7 @@ main(int argc, char **argv)
sleep(5);
}
- qd_init(&ctx, ch, me.cn_nodeid);
+ qd_init(&ctx, ch_admin, ch_user, me.cn_nodeid);
signal(SIGINT, int_handler);
signal(SIGTERM, int_handler);
@@ -1715,13 +1709,13 @@ main(int argc, char **argv)
if (!_running)
goto out;
- if ((rv = cman_register_quorum_device(ctx.qc_ch,
+ if ((rv = cman_register_quorum_device(ctx.qc_ch_admin,
(ctx.qc_flags&RF_CMAN_LABEL)?
ctx.qc_cman_label:
ctx.qc_device,
ctx.qc_votes)) < 0) {
if (errno == EBUSY) {
- if ((rv = cman_update_quorum_device(ctx.qc_ch,
+ if ((rv = cman_update_quorum_device(ctx.qc_ch_admin,
(ctx.qc_flags&RF_CMAN_LABEL)?
ctx.qc_cman_label:
ctx.qc_device,
@@ -1740,17 +1734,18 @@ main(int argc, char **argv)
}
}
- io_nanny_start(ch, ctx.qc_tko * ctx.qc_interval);
+ io_nanny_start(ch_user, ctx.qc_tko * ctx.qc_interval);
if (quorum_loop(&ctx, ni, MAX_NODES_DISK) == 0)
- cman_unregister_quorum_device(ctx.qc_ch);
+ cman_unregister_quorum_device(ctx.qc_ch_admin);
io_nanny_stop();
quorum_logout(&ctx);
/* free cman handle to avoid leak in cman */
out:
- cman_finish(ctx.qc_ch);
+ cman_finish(ctx.qc_ch_admin);
+ cman_finish(ctx.qc_ch_user);
qd_destroy(&ctx);
return ret;
11 years, 8 months
fence-agents: master - fence_kdump: Typo in fence_kdump_send man page.
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=36559e...
Commit: 36559eaf7102932df1e3250f018a587c12c5ce67
Parent: b2afa6263795d06bbfc027444c812a7c20d500c7
Author: Masatake YAMATO <yamato(a)redhat.com>
AuthorDate: Mon May 7 18:08:35 2012 +0900
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Aug 9 15:04:42 2012 +0200
fence_kdump: Typo in fence_kdump_send man page.
Signed-off-by: Masatake YAMATOi <yamato(a)redhat.com>
Reviewed-by: Ryan O'Hara <rohara(a)redhat.com>
---
fence/agents/kdump/fence_kdump_send.8 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/agents/kdump/fence_kdump_send.8 b/fence/agents/kdump/fence_kdump_send.8
index 4cec124..ab95836 100644
--- a/fence/agents/kdump/fence_kdump_send.8
+++ b/fence/agents/kdump/fence_kdump_send.8
@@ -16,7 +16,7 @@ kdump kernel after a cluster node has encountered a kernel panic. Once
the cluster node has entered the kdump crash recovery service,
\fIfence_kdump_send\fP will periodically send messages to all cluster
nodes. When the \fIfence_kdump\fP agent receives a valid message from
-the failed not, fencing is complete.
+the failed node, fencing is complete.
.SH OPTIONS
.TP
.B -p, --ipport=\fIPORT\fP
11 years, 8 months
fence-agents: master - fence_virsh: Support for using sudo for running virsh
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=b2afa6...
Commit: b2afa6263795d06bbfc027444c812a7c20d500c7
Parent: 3cd42f9de648ae2d7f2bbd49530f7adf18cf80a9
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu Aug 9 15:02:23 2012 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Aug 9 15:02:23 2012 +0200
fence_virsh: Support for using sudo for running virsh
Based on patch from Niels de Vos (in bugzilla)
Resolves: rhbz#632851
---
fence/agents/lib/fencing.py.py | 14 +++++++++++---
fence/agents/virsh/fence_virsh.py | 17 ++++++++++++++---
2 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index cb8ec26..2cc6e7b 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -30,6 +30,7 @@ EC_PASSWORD_MISSING = 10
TELNET_PATH = "/usr/bin/telnet"
SSH_PATH = "/usr/bin/ssh"
SSL_PATH = "@SBINDIR@/fence_nss_wrapper"
+SUDO_PATH = "/usr/bin/sudo"
all_opt = {
"help" : {
@@ -386,17 +387,24 @@ all_opt = {
"session_url" : {
"getopt" : "s:",
"longopt" : "session-url",
- "help" : "-s, --session-url URL to connect to XenServer on.",
+ "help" : "-s, --session-url URL to connect to XenServer on",
"required" : "1",
"shortdesc" : "The URL of the XenServer host.",
"order" : 1},
"uuid" : {
"getopt" : "U:",
"longopt" : "uuid",
- "help" : "-U, --uuid UUID of the VM to fence.",
+ "help" : "-U, --uuid UUID of the VM to fence",
"required" : "0",
"shortdesc" : "The UUID of the virtual machine to fence.",
- "order" : 1}
+ "order" : 1},
+ "sudo" : {
+ "getopt" : "d",
+ "longopt" : "use-sudo",
+ "help" : "--use-sudo Use sudo (without password) when calling 3rd party software",
+ "required" : "0",
+ "shortdesc" : "Use sudo (without password) when calling 3rd party sotfware.",
+ "order" : 205}
}
common_opt = [ "retry_on", "delay" ]
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index 13099da..4859d7d 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -16,8 +16,14 @@ BUILD_DATE=""
#END_VERSION_GENERATION
def get_outlets_status(conn, options):
+ if options.has_key("-d"):
+ prefix = SUDO_PATH + " "
+ else:
+ prefix = ""
+
try:
- conn.sendline("virsh list --all")
+ conn.sendline(prefix + "virsh list --all")
+ conn.interact()
conn.log_expect(options, options["-c"], int(options["-Y"]))
except pexpect.EOF:
fail(EC_CONNECTION_LOST)
@@ -48,8 +54,13 @@ def get_power_status(conn, options):
return outlets[options["-n"]][1]
def set_power_status(conn, options):
+ if options.has_key("-d"):
+ prefix = SUDO_PATH + " "
+ else:
+ prefix = ""
+
try:
- conn.sendline("virsh %s "%(options["-o"] == "on" and "start" or "destroy")+options["-n"])
+ conn.sendline(prefix + "virsh %s "%(options["-o"] == "on" and "start" or "destroy")+options["-n"])
conn.log_expect(options, options["-c"], int(options["-g"]))
time.sleep(1)
@@ -63,7 +74,7 @@ def main():
device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
"action", "ipaddr", "login", "passwd", "passwd_script",
"secure", "identity_file", "test", "port", "separator",
- "inet4_only", "inet6_only", "ipport",
+ "inet4_only", "inet6_only", "ipport", "sudo",
"power_timeout", "shell_timeout", "login_timeout", "power_wait" ]
atexit.register(atexit_handler)
11 years, 8 months
cluster: RHEL59 - fence_ipdu: Fix path to fencing library
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=409112bc764...
Commit: 409112bc764b8ea27fcdf57668ebd5225a6c0f8b
Parent: 948039781676caa798a038c4132a5ea3fddf0a2a
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu Aug 9 12:26:40 2012 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Aug 9 12:26:40 2012 +0200
fence_ipdu: Fix path to fencing library
Resolves: rhbz#741985
---
fence/agents/ipdu/fence_ipdu.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/agents/ipdu/fence_ipdu.py b/fence/agents/ipdu/fence_ipdu.py
index aac0b7d..c14af34 100644
--- a/fence/agents/ipdu/fence_ipdu.py
+++ b/fence/agents/ipdu/fence_ipdu.py
@@ -6,7 +6,7 @@
#
import sys, re, pexpect
-sys.path.append("/usr/share/fence")
+sys.path.append("/usr/lib/fence")
from fencing import *
from fencing_snmp import *
11 years, 9 months
cluster: RHEL59 - fence_ipdu: New fence agent for IBM iPDU
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=94803978167...
Commit: 948039781676caa798a038c4132a5ea3fddf0a2a
Parent: c194015e07a134ec26551fdd65d3463696136628
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu Aug 9 12:25:28 2012 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Aug 9 12:25:28 2012 +0200
fence_ipdu: New fence agent for IBM iPDU
Resolves: rhbz#741985
---
fence/agents/ipdu/Makefile | 44 ++++++++++
fence/agents/ipdu/fence_ipdu.py | 170 +++++++++++++++++++++++++++++++++++++++
2 files changed, 214 insertions(+), 0 deletions(-)
diff --git a/fence/agents/ipdu/Makefile b/fence/agents/ipdu/Makefile
new file mode 100644
index 0000000..c49619f
--- /dev/null
+++ b/fence/agents/ipdu/Makefile
@@ -0,0 +1,44 @@
+###############################################################################
+###############################################################################
+##
+## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
+## Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+##
+## This copyrighted material is made available to anyone wishing to use,
+## modify, copy, or redistribute it subject to the terms and conditions
+## of the GNU General Public License v.2.
+##
+###############################################################################
+###############################################################################
+
+SOURCE= fence_ipdu.py
+TARGET= fence_ipdu
+MANTARGET= $(TARGET).8
+
+top_srcdir=../..
+include ${top_srcdir}/make/defines.mk
+
+all: $(TARGET) $(MANTARGET)
+
+fence_ipdu: fence_ipdu.py
+ : > $(TARGET)
+ awk "{print}(\$$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $(SOURCE) >> $(TARGET)
+ echo "FENCE_RELEASE_NAME=\"${RELEASE}\";" >> $(TARGET)
+ ${top_srcdir}/scripts/define2var ${top_srcdir}/config/copyright.cf sh REDHAT_COPYRIGHT >> $(TARGET)
+ echo "BUILD_DATE=\"(built `date`)\";" >> $(TARGET)
+ awk -v p=0 "(\$$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $(SOURCE) >> $(TARGET)
+ chmod +x $(TARGET)
+
+install: all
+ if [ ! -d ${sbindir} ]; then \
+ install -d ${sbindir}; \
+ fi
+ install -m755 ${TARGET} ${sbindir}
+
+ if [ ! -d ${mandir}/man8 ]; then \
+ install -d ${mandir}/man8; \
+ fi
+ install -m644 ${MANTARGET} ${mandir}/man8
+
+clean:
+ rm -f $(TARGET) $(MANTARGET)
diff --git a/fence/agents/ipdu/fence_ipdu.py b/fence/agents/ipdu/fence_ipdu.py
new file mode 100644
index 0000000..aac0b7d
--- /dev/null
+++ b/fence/agents/ipdu/fence_ipdu.py
@@ -0,0 +1,170 @@
+#!/usr/bin/python
+
+# The Following agent has been tested on:
+# IBM iPDU model 46M4002
+# Firmware release OPDP_sIBM_v01.2_1
+#
+
+import sys, re, pexpect
+sys.path.append("/usr/share/fence")
+from fencing import *
+from fencing_snmp import *
+
+#BEGIN_VERSION_GENERATION
+RELEASE_VERSION="IBM iPDU SNMP fence agent"
+REDHAT_COPYRIGHT=""
+BUILD_DATE=""
+#END_VERSION_GENERATION
+
+### CONSTANTS ###
+# oid defining fence device
+OID_SYS_OBJECT_ID='.1.3.6.1.2.1.1.2.0'
+
+### GLOBAL VARIABLES ###
+# Device - see IBM iPDU
+device=None
+
+# Port ID
+port_id=None
+# Switch ID
+switch_id=None
+
+# Classes describing Device params
+class IBMiPDU:
+ # iPDU
+ status_oid= '.1.3.6.1.4.1.2.6.223.8.2.2.1.11.%d'
+ control_oid= '.1.3.6.1.4.1.2.6.223.8.2.2.1.11.%d'
+ outlet_table_oid='.1.3.6.1.4.1.2.6.223.8.2.2.1.2'
+ ident_str="IBM iPDU"
+ state_on=1
+ state_off=0
+ turn_on=1
+ turn_off=0
+ has_switches=False
+
+### FUNCTIONS ###
+def ipdu_set_device(conn,options):
+ global device
+
+ agents_dir={'.1.3.6.1.4.1.2.6.223':IBMiPDU,
+ None:IBMiPDU}
+
+ # First resolve type of PDU device
+ pdu_type=conn.walk(OID_SYS_OBJECT_ID)
+
+ if (not ((len(pdu_type)==1) and (agents_dir.has_key(pdu_type[0][1])))):
+ pdu_type=[[None,None]]
+
+ device=agents_dir[pdu_type[0][1]]
+
+ conn.log_command("Trying %s"%(device.ident_str))
+
+def ipdu_resolv_port_id(conn,options):
+ global port_id,switch_id,device
+
+ if (device==None):
+ ipdu_set_device(conn,options)
+
+ # Now we resolv port_id/switch_id
+ if ((options["-n"].isdigit()) and ((not device.has_switches) or (options["-s"].isdigit()))):
+ port_id=int(options["-n"])
+
+ if (device.has_switches):
+ switch_id=int(options["-s"])
+ else:
+ table=conn.walk(device.outlet_table_oid,30)
+
+ for x in table:
+ if (x[1].strip('"')==options["-n"]):
+ t=x[0].split('.')
+ if (device.has_switches):
+ port_id=int(t[len(t)-1])
+ switch_id=int(t[len(t)-3])
+ else:
+ port_id=int(t[len(t)-1])
+
+ if (port_id==None):
+ fail_usage("Can't find port with name %s!"%(options["-n"]))
+
+def get_power_status(conn,options):
+ global port_id,switch_id,device
+
+ if (port_id==None):
+ ipdu_resolv_port_id(conn,options)
+
+ oid=((device.has_switches) and device.status_oid%(switch_id,port_id) or device.status_oid%(port_id))
+
+ (oid,status)=conn.get(oid)
+ return (status==str(device.state_on) and "on" or "off")
+
+def set_power_status(conn, options):
+ global port_id,switch_id,device
+
+ if (port_id==None):
+ ipdu_resolv_port_id(conn,options)
+
+ oid=((device.has_switches) and device.control_oid%(switch_id,port_id) or device.control_oid%(port_id))
+
+ conn.set(oid,(options["-o"]=="on" and device.turn_on or device.turn_off))
+
+
+def get_outlets_status(conn, options):
+ global device
+
+ result={}
+
+ if (device==None):
+ ipdu_set_device(conn,options)
+
+ res_ports=conn.walk(device.outlet_table_oid,30)
+
+ for x in res_ports:
+ t=x[0].split('.')
+
+ port_num=((device.has_switches) and "%s:%s"%(t[len(t)-3],t[len(t)-1]) or "%s"%(t[len(t)-1]))
+
+ port_name=x[1].strip('"')
+ port_status=""
+ result[port_num]=(port_name,port_status)
+
+ return result
+
+# Define new options
+def ipdu_snmp_define_defaults():
+ all_opt["snmp_version"]["default"]="3"
+ all_opt["community"]["default"]="private"
+ all_opt["switch"]["default"]="1"
+ device=IBMiPDU
+
+# Main agent method
+def main():
+ device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
+ "action", "ipaddr", "login", "passwd", "passwd_script",
+ "test", "port", "separator", "no_login", "no_password",
+ "snmp_version", "community", "snmp_auth_prot", "snmp_sec_level",
+ "snmp_priv_prot", "snmp_priv_passwd", "snmp_priv_passwd_script",
+ "udpport","inet4_only","inet6_only",
+ "power_timeout", "shell_timeout", "login_timeout", "power_wait" ]
+
+ atexit.register(atexit_handler)
+
+ snmp_define_defaults ()
+ ipdu_snmp_define_defaults()
+
+ options=check_input(device_opt,process_input(device_opt))
+
+ docs = { }
+ docs["shortdesc"] = "Fence agent for iPDU over SNMP"
+ docs["longdesc"] = "fence_ipdu is an I/O Fencing agent \
+which can be used with the IBM iPDU network power switch. It logs \
+into a device via SNMP and reboots a specified outlet. It supports \
+SNMP v3 with all combinations of authenticity/privacy settings."
+ docs["vendorurl"] = "http://www.ibm.com"
+ show_docs(options, docs)
+
+ # Operate the fencing device
+ result = fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
+
+ sys.exit(result)
+if __name__ == "__main__":
+ main()
11 years, 9 months
cluster: STABLE32 - fenced: fix log file mode
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=b8b42d0d84a...
Commit: b8b42d0d84a895490116ef08bd97733697e5e417
Parent: ebac037f4fa11de5f803c6025c5b182c962e84d1
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Aug 3 10:12:15 2012 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Aug 3 11:11:24 2012 -0500
fenced: fix log file mode
Remove umask(0) which caused liblogthread's fopen to
create fenced.log with mode 666.
Check if existing fenced.log has mode 666 and if so,
chmod to 644.
bz 845341
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
fence/fenced/logging.c | 31 +++++++++++++++++++++++++++++++
fence/fenced/main.c | 1 -
2 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/fence/fenced/logging.c b/fence/fenced/logging.c
index a6a1a66..56a7e08 100644
--- a/fence/fenced/logging.c
+++ b/fence/fenced/logging.c
@@ -39,8 +39,13 @@ void init_logging(void)
logfile_priority, logfile);
}
+#define DEFAULT_LOGFILE_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)
+
void setup_logging(void)
{
+ struct stat buf;
+ int rv;
+
ccs_read_logging(ccs_handle, DAEMON_NAME,
&cfgd_debug_logfile, &log_mode,
&syslog_facility, &syslog_priority,
@@ -52,6 +57,32 @@ void setup_logging(void)
logt_conf(DAEMON_NAME, log_mode, syslog_facility, syslog_priority,
logfile_priority, logfile);
+
+ /*
+ * Previously fenced.log was created with mode 666,
+ * so fix it to be 644.
+ */
+
+ rv = stat(logfile, &buf);
+ if (rv)
+ return;
+
+ log_debug("logfile cur mode %lo", (unsigned long)buf.st_mode);
+
+ if ((buf.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO)) == DEFAULT_LOGFILE_MODE)
+ return;
+
+ rv = chmod(logfile, DEFAULT_LOGFILE_MODE);
+ if (rv) {
+ log_error("chmod error %d", errno);
+ return;
+ }
+
+ rv = stat(logfile, &buf);
+ if (rv)
+ return;
+
+ log_debug("logfile new mode %lo", (unsigned long)buf.st_mode);
}
void close_logging(void)
diff --git a/fence/fenced/main.c b/fence/fenced/main.c
index a9fecb5..312414c 100644
--- a/fence/fenced/main.c
+++ b/fence/fenced/main.c
@@ -1027,7 +1027,6 @@ int main(int argc, char **argv)
perror("main: cannot fork");
exit(EXIT_FAILURE);
}
- umask(0);
}
lockfile();
init_logging();
11 years, 9 months