Skip to contentSkip to conversation

fence_zvmip: Port fence agent to fencing library

PATCH New Marek 'marx' Grac 1 participant 1 message Dec 22, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fence_zvmip: Port fence agent to fencing library

This rewrite adds a correct result codes, support for 'list' action and autogenerated manual page. The original code is still part of codebase as new agent requires additional testing.

Additional fix that makes fence agent work if output information is longer than MTU.

---
 fence/agents/lib/fencing.py.py  |   4 +
 fence/agents/zvm/Makefile.am    |  26 ++----
 fence/agents/zvm/fence_zvmip.8  |  92 ---------------------
 fence/agents/zvm/fence_zvmip.py | 171 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 183 insertions(+), 110 deletions(-)
 delete mode 100644 fence/agents/zvm/fence_zvmip.8
 create mode 100644 fence/agents/zvm/fence_zvmip.py
fence/agents/lib/fencing.py.py +4 -0
index 5449373..c122d96 100644
@@ -7,6 +7,7 @@ import subprocess
 import threading
 import shlex
 import exceptions
+import socket
 import __main__
 
 ## do not add code here.
@@ -805,6 +806,9 @@ def fence_action(connection, options, set_power_fn, get_power_fn, get_outlet_lis
 	except pycurl.error, ex:
 		logging.error("%s\n", str(ex))
 		fail(EC_TIMED_OUT)
+	except socket.timeout, ex:
+		logging.error("%s\n", str(ex))
+		fail(EC_TIMED_OUT)
 
 	return result
 
fence/agents/zvm/Makefile.am +8 -18
index 62eb862..a29754d 100644
@@ -2,26 +2,16 @@ MAINTAINERCLEANFILES	= Makefile.in
 
 TARGET			= fence_zvmip
 
-sbin_PROGRAMS		= fence_zvm fence_zvmip
+SRC			= $(TARGET).py
 
-noinst_HEADERS		= fence_zvm.h
+EXTRA_DIST		= $(SRC)
 
-fence_zvm_SOURCES	= fence_zvm.c
-fence_zvm_CFLAGS	= -D_GNU_SOURCE
+sbin_SCRIPTS		= $(TARGET)
 
-fence_zvmip_SOURCES	= fence_zvmip.c
-fence_zvmip_CFLAGS	= -D_GNU_SOURCE
+man_MANS		= $(TARGET).8
 
-dist_man_MANS		= fence_zvm.8 fence_zvmip.8
+FENCE_TEST_ARGS         = -l test -p test -a test -n 1
 
-#include $(top_srcdir)/make/fencemanc.mk
-
-clean-local:
-	rm -f $(sbin_PROGRAMS)
-
-FENCE_TEST_ARGS		= -n test -a test -p test -u test
-
-include $(top_srcdir)/make/agentccheck.mk
-
-# we do not test fence_zvm because it can be compiled only on specific architecture
-check: xml-check.fence_zvmip delay-check.fence_zvmip
\ No newline at end of file
+include $(top_srcdir)/make/fencebuild.mk
+include $(top_srcdir)/make/fenceman.mk
+include $(top_srcdir)/make/agentpycheck.mk
fence/agents/zvm/fence_zvmip.8 deleted +0 -92

92 lines not on this page · raw message

fence/agents/zvm/fence_zvmip.py new file +171 -0

171 lines not on this page · raw message

Signature · 1 line
1.9.3