fence-agents: v4.0.5 annotated tag has been created
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=c5e635...
Commit: c5e6352c59457560dde6ca2eef44104c780b48dd
Parent: 0000000000000000000000000000000000000000
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: 2013-10-30 13:28 +0000
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: 2013-10-30 13:28 +0000
annotated tag: v4.0.5 has been created
at c5e6352c59457560dde6ca2eef44104c780b48dd (tag)
tagging eb546e504e720bd97258a70ef96e4e51e5778009 (commit)
replaces v4.0.4
v4.0.5 release
Marek 'marx' Grac (9):
fencing: Add schema for fence agents metadata (relax ng)
fence_vmware_soap: Correct error message when user does not have privileges
testing: Check if fence agent uses only valid keys in options["--???"]
fence_drac5: Fix test used for Dell DRAC CMC
fence_vmware: Option --vmware_type is not used correctly
fence_xenapy: Fix invalid use of options
fence_wti: Add support for named groups
fence_rsb: Change in power status output
[build] updates in build system to properly work with metadata.rng
10 years, 5 months
fence-agents: master - [build] updates in build system to properly work with metadata.rng
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=eb546e...
Commit: eb546e504e720bd97258a70ef96e4e51e5778009
Parent: 9c3cf5bfe41559191510c32be9195da6ee00d06d
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Oct 30 14:24:24 2013 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Oct 30 14:24:24 2013 +0100
[build] updates in build system to properly work with metadata.rng
Minor updates were required to build a package without this patch you
can do ./autogen.sh; ./configure; make - but not a build package process
---
fence/agents/lib/Makefile.am | 4 ++--
make/fencebuild.mk | 8 ++++----
make/fenceman.mk | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fence/agents/lib/Makefile.am b/fence/agents/lib/Makefile.am
index f2fbb09..4cf4b9f 100644
--- a/fence/agents/lib/Makefile.am
+++ b/fence/agents/lib/Makefile.am
@@ -6,11 +6,11 @@ if BUILD_XENAPILIB
TARGET += XenAPI.py
endif
-SRC = fencing.py.py fencing_snmp.py.py XenAPI.py.py
+SRC = fencing.py.py fencing_snmp.py.py XenAPI.py.py check_used_options.py
XSL = fence2man.xsl fence2rng.xsl
-FASRNG = fence.rng.head fence.rng.tail
+FASRNG = fence.rng.head fence.rng.tail metadata.rng
EXTRA_DIST = $(SRC) $(XSL) $(FASRNG)
diff --git a/make/fencebuild.mk b/make/fencebuild.mk
index d775e92..15a47fd 100644
--- a/make/fencebuild.mk
+++ b/make/fencebuild.mk
@@ -1,8 +1,4 @@
$(TARGET): $(SRC)
- if [ 0 -eq `echo "$(SRC)" | grep fence_ &> /dev/null; echo $$?` ]; then \
- PYTHONPATH=$(abs_srcdir)/../lib:$(abs_builddir)/../lib $(top_srcdir)/fence/agents/lib/check_used_options.py $(SRC); \
- else true ; fi
-
bash $(top_srcdir)/scripts/fenceparse \
$(top_srcdir)/make/copyright.cf REDHAT_COPYRIGHT \
$(VERSION) \
@@ -14,3 +10,7 @@ $(TARGET): $(SRC)
-e 's#@''SBINDIR@#${sbindir}#g' \
-e 's#@''LIBEXECDIR@#${libexecdir}#g' \
> $@
+
+ if [ 0 -eq `echo "$(SRC)" | grep fence_ &> /dev/null; echo $$?` ]; then \
+ PYTHONPATH=$(abs_srcdir)/../lib:$(abs_builddir)/../lib $(top_srcdir)/fence/agents/lib/check_used_options.py $@; \
+ else true ; fi
diff --git a/make/fenceman.mk b/make/fenceman.mk
index d4f3b4e..d4f0377 100644
--- a/make/fenceman.mk
+++ b/make/fenceman.mk
@@ -2,7 +2,7 @@
set -e && \
PYTHONPATH=$(abs_srcdir)/../lib:$(abs_builddir)/../lib \
python $^ -o metadata > .$@.tmp && \
- xmllint --noout --relaxng $(top_srcdir)/fence/agents/lib/metadata.rng .$@.tmp && \
+ xmllint --noout --relaxng $(abs_srcdir)/../lib/metadata.rng .$@.tmp && \
xsltproc $(top_srcdir)/fence/agents/lib/fence2man.xsl .$@.tmp > $@
clean-man:
10 years, 5 months
fence-agents: master - fence_rsb: Change in power status output
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=9c3cf5...
Commit: 9c3cf5bfe41559191510c32be9195da6ee00d06d
Parent: 0b92cea4cb27f248834d77a72266ba5bf69c1d95
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Oct 23 09:46:44 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Oct 23 09:46:44 2013 +0200
fence_rsb: Change in power status output
Regular expression was extended to support newer version.
Patch by: Christian Masopust
---
fence/agents/rsb/fence_rsb.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py
index 1da186f..da60a61 100755
--- a/fence/agents/rsb/fence_rsb.py
+++ b/fence/agents/rsb/fence_rsb.py
@@ -13,7 +13,7 @@ BUILD_DATE=""
def get_power_status(conn, options):
conn.send("2")
conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
- status = re.compile("Power Status : (on|off)", re.IGNORECASE).search(conn.before).group(1)
+ status = re.compile("Power Status[\s]*: (on|off)", re.IGNORECASE).search(conn.before).group(1)
conn.send("0")
conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
10 years, 6 months
fence-agents: master - fence_wti: Add support for named groups
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=0b92ce...
Commit: 0b92cea4cb27f248834d77a72266ba5bf69c1d95
Parent: bef51987fa30fe17458dfcc5d817bc232377f349
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Oct 21 13:50:06 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Oct 21 13:50:06 2013 +0200
fence_wti: Add support for named groups
On some WTI devices it is possible to name a group of devices by single names (e.g. 1,2 -> server). These
groups can be used to operate all these plugs by single command.
Patch by: Thibat Pouzet
---
fence/agents/wti/fence_wti.py | 87 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 84 insertions(+), 3 deletions(-)
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index b315061..34967e1 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -21,10 +21,10 @@ REDHAT_COPYRIGHT=""
BUILD_DATE="March, 2008"
#END_VERSION_GENERATION
-def get_power_status(conn, options):
+def get_listing(conn, options, listing_command):
listing = ""
- conn.send("/S"+"\r\n")
+ conn.send(listing_command + "\r\n")
if isinstance(options["--command-prompt"], list):
re_all = list(options["--command-prompt"])
@@ -39,7 +39,12 @@ def get_power_status(conn, options):
conn.send("\r\n")
conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
listing += conn.before
-
+
+ return listing
+
+def get_plug_status(conn, options):
+ listing = get_listing(conn, options, "/S")
+
plug_section = 0
plug_index = -1
name_index = -1
@@ -72,6 +77,82 @@ def get_power_status(conn, options):
else:
return "PROBLEM"
+def get_plug_group_status_from_list(status_list):
+ for status in status_list:
+ if status == "on":
+ return status
+ return "off"
+
+def get_plug_group_status(conn, options):
+ listing = get_listing(conn, options, "/SG")
+
+ plug_section = 0
+ outlets = {}
+ current_outlet = ""
+ line_index = 0
+ lines = listing.splitlines()
+ while line_index < len(lines) and line_index >= 0:
+ line = lines[line_index]
+ if (line.find("|") >= 0 and line.lstrip().startswith("GROUP NAME") == False):
+ plug_line = [x.strip().lower() for x in line.split("|")]
+ if ["list", "monitor"].count(options["--action"]) == 0 and options["--plug"].lower() == plug_line[name_index]:
+ line_index += 1
+ plug_status = []
+ while line_index < len(lines) and line_index >= 0:
+ plug_line = [x.strip().lower() for x in lines[line_index].split("|")]
+ if len(plug_line[plug_index]) > 0 and len(plug_line[name_index]) == 0:
+ plug_status.append(plug_line[status_index])
+ line_index += 1
+ else:
+ line_index = -1
+
+ return get_plug_group_status_from_list(plug_status)
+
+ else:
+ ## We already believe that first column contains plug number
+ if len(plug_line[0]) != 0:
+ group_name = plug_line[0]
+ plug_line_index = line_index + 1
+ plug_status = []
+ while plug_line_index < len(lines) and plug_line_index >= 0:
+ plug_line = [x.strip().lower() for x in lines[plug_line_index].split("|")]
+ if len(plug_line[name_index]) > 0:
+ plug_line_index = -1
+ break
+ if len(plug_line[plug_index]) > 0:
+ plug_status.append(plug_line[status_index])
+ plug_line_index += 1
+ else:
+ plug_line_index = -1
+ outlets[group_name] = (group_name, get_plug_group_status_from_list(plug_status))
+ line_index += 1
+
+ elif (line.upper().lstrip().startswith("GROUP NAME")):
+ plug_header = [x.strip().lower() for x in line.split("|")]
+ name_index = plug_header.index("group name")
+ plug_index = plug_header.index("plug")
+ status_index = plug_header.index("status")
+ line_index += 2
+ else:
+ line_index += 1
+
+
+ if ["list", "monitor"].count(options["--action"]) == 1:
+ for group, status in outlet_groups:
+ outlets[group] = (group, status[0])
+
+ return outlets
+ else:
+ return "PROBLEM"
+
+def get_power_status(conn, options):
+ ret = get_plug_status(conn, options)
+
+ if ret == "PROBLEM":
+ ret = get_plug_group_status(conn, options)
+
+ return ret
+
def set_power_status(conn, options):
action = {
'on' : "/on",
10 years, 6 months
fence-agents: master - fence_xenapy: Fix invalid use of options
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=bef519...
Commit: bef51987fa30fe17458dfcc5d817bc232377f349
Parent: 110274aa54e8673a47653da7c9fecb2bd95bd517
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Oct 21 12:48:48 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Oct 21 12:48:48 2013 +0200
fence_xenapy: Fix invalid use of options
Fixing typos (--passwd -> --password; --uid --> --uuid)
---
fence/agents/xenapi/fence_xenapi.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fence/agents/xenapi/fence_xenapi.py b/fence/agents/xenapi/fence_xenapi.py
index 064624a..9cf200a 100644
--- a/fence/agents/xenapi/fence_xenapi.py
+++ b/fence/agents/xenapi/fence_xenapi.py
@@ -131,7 +131,7 @@ def get_outlet_list(session, options):
def connect_and_login(options):
url = options["--session-url"]
username = options["--username"]
- password = options["--passwd"]
+ password = options["--password"]
try:
# Create the XML RPC session to the specified URL.
@@ -158,8 +158,8 @@ def return_vm_reference(session, options):
verbose = False
# Case where the UUID has been specified
- if options.has_key("--uid"):
- uuid = options["--uid"].lower()
+ if options.has_key("--uuid"):
+ uuid = options["--uuid"].lower()
# When using the -n parameter for name, we get an error message (in verbose
# mode) that tells us that we didn't find a VM. To immitate that here we
# need to catch and re-raise the exception produced by get_by_uuid.
10 years, 6 months
fence-agents: master - fence_vmware: Option --vmware_type is not used correctly
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=110274...
Commit: 110274aa54e8673a47653da7c9fecb2bd95bd517
Parent: 38373e3be9ceedd877ce6c02a88acf059f9f9d42
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Oct 21 12:45:35 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Oct 21 12:45:35 2013 +0200
fence_vmware: Option --vmware_type is not used correctly
--vmware_type is defined but --vmware-type was used in source code.
---
fence/agents/vmware/fence_vmware.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index 87d0958..dc4ef0f 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -261,17 +261,17 @@ def vmware_is_supported_vmrun_version(options):
def vmware_check_vmware_type(options):
global vmware_internal_type
- options["--vmware-type"] = options["--vmware-type"].lower()
+ options["--vmware_type"] = options["--vmware_type"].lower()
- if (options["--vmware-type"]=="esx"):
+ if (options["--vmware_type"]=="esx"):
vmware_internal_type = VMWARE_TYPE_ESX
if (not options.has_key("--exec")):
options["--exec"] = VMHELPER_COMMAND
- elif (options["--vmware-type"]=="server2"):
+ elif (options["--vmware_type"]=="server2"):
vmware_internal_type = VMWARE_TYPE_SERVER2
if (not options.has_key("--exec")):
options["--exec"] = VMRUN_COMMAND
- elif (options["--vmware-type"]=="server1"):
+ elif (options["--vmware_type"]=="server1"):
vmware_internal_type = VMWARE_TYPE_SERVER1
if (not options.has_key("--exec")):
options["--exec"] = VMRUN_COMMAND
10 years, 6 months
fence-agents: master - fence_drac5: Fix test used for Dell DRAC CMC
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=38373e...
Commit: 38373e3be9ceedd877ce6c02a88acf059f9f9d42
Parent: 1db6440eb38789bcb59451cb8adb39f2084f9443
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Sun Oct 20 17:06:08 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Oct 21 12:45:09 2013 +0200
fence_drac5: Fix test used for Dell DRAC CMC
In version 4.x the '--module-name' was renamed to standard '--plug'. This patch
reflects it.
---
fence/agents/drac5/fence_drac5.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fence/agents/drac5/fence_drac5.py b/fence/agents/drac5/fence_drac5.py
index 2e9a8d3..1b16733 100644
--- a/fence/agents/drac5/fence_drac5.py
+++ b/fence/agents/drac5/fence_drac5.py
@@ -112,8 +112,8 @@ By default, the telnet interface is not enabled."
conn = fence_login(options)
if conn.before.find("CMC") >= 0:
- if 0 == options.has_key("--module-name") and 0 == ["monitor", "list"].count(options["--action"].lower()):
- fail_usage("Failed: You have to enter module name (-m)")
+ if 0 == options.has_key("--plug") and 0 == ["monitor", "list"].count(options["--action"].lower()):
+ fail_usage("Failed: You have to enter module name (-n)")
options["model"] = "DRAC CMC"
elif conn.before.find("DRAC 5") >= 0:
10 years, 6 months
fence-agents: master - testing: Check if fence agent uses only valid keys in options["--???"]
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=1db644...
Commit: 1db6440eb38789bcb59451cb8adb39f2084f9443
Parent: be464e49a941f727812615107cbeeda119cf5669
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Oct 21 12:44:39 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Oct 21 12:44:39 2013 +0200
testing: Check if fence agent uses only valid keys in options["--???"]
Valid keys are defined in fencing library or fence agent itself. This check
will be run at every build, so we should be protected against case when
developer unintentionally use new key (e.g. typo). These type of bugs are
usually not detected by static analyzers.
---
fence/agents/lib/check_used_options.py | 65 ++++++++++++++++++++++++++++++++
make/fencebuild.mk | 4 ++
2 files changed, 69 insertions(+), 0 deletions(-)
diff --git a/fence/agents/lib/check_used_options.py b/fence/agents/lib/check_used_options.py
new file mode 100755
index 0000000..2d75756
--- /dev/null
+++ b/fence/agents/lib/check_used_options.py
@@ -0,0 +1,65 @@
+#!/usr/bin/python
+
+## Check if fence agent uses only options["--??"] which are defined in fencing library or
+## fence agent itself
+##
+## Usage: ./check_used_options.py fence-agent (e.g. lpar/fence_lpar.py)
+##
+
+import sys, re
+sys.path.append("@FENCEAGENTSLIBDIR@")
+from fencing import all_opt
+
+def main():
+ agent = sys.argv[1]
+
+ available = { }
+
+ ## all_opt from fencing library are imported
+ for k in all_opt.keys():
+ if all_opt[k].has_key("longopt"):
+ available["--" + all_opt[k]["longopt"]] = True
+
+ ## add UUID which is derived automatically from --plug if possible
+ available["--uuid"] = True
+
+ ## all_opt defined in fence agent are found
+ agent_file = open(agent)
+ opt_re = re.compile("\s*all_opt\[\"([^\"]*)\"\] = {")
+ opt_longopt_re = re.compile("\s*\"longopt\" : \"([^\"]*)\"")
+
+ in_opt = False
+ for line in agent_file:
+ if opt_re.search(line) != None:
+ in_opt = True
+ if in_opt and opt_longopt_re.search(line) != None:
+ available["--" + opt_longopt_re.search(line).group(1)] = True
+ in_opt = False
+
+ ## check if all options are defined
+ agent_file = open(agent)
+ option_use_re = re.compile("options\[\"(--[^\"]*)\"\]")
+ option_has_re = re.compile("options.has_key\(\"(--[^\"]*)\"\)")
+
+ counter = 0
+ without_errors = True
+ for line in agent_file:
+ counter += 1
+
+ for x in option_use_re.findall(line):
+ if not available.has_key(x):
+ print "ERROR on line %d in %s: option %s is not defined" % (counter, agent, option_use_re.search(line).group(1))
+ without_errors = False
+
+ for x in option_has_re.findall(line):
+ if not available.has_key(x):
+ print "ERROR on line %d in %s: option %s is not defined" % (counter, agent, option_has_re.search(line).group(1))
+ without_errors = False
+
+ if without_errors:
+ sys.exit(0)
+ else:
+ sys.exit(1)
+
+if __name__ == "__main__":
+ main()
diff --git a/make/fencebuild.mk b/make/fencebuild.mk
index e86d03c..d775e92 100644
--- a/make/fencebuild.mk
+++ b/make/fencebuild.mk
@@ -1,4 +1,8 @@
$(TARGET): $(SRC)
+ if [ 0 -eq `echo "$(SRC)" | grep fence_ &> /dev/null; echo $$?` ]; then \
+ PYTHONPATH=$(abs_srcdir)/../lib:$(abs_builddir)/../lib $(top_srcdir)/fence/agents/lib/check_used_options.py $(SRC); \
+ else true ; fi
+
bash $(top_srcdir)/scripts/fenceparse \
$(top_srcdir)/make/copyright.cf REDHAT_COPYRIGHT \
$(VERSION) \
10 years, 6 months
fence-agents: master - fence_vmware_soap: Correct error message when user does not have privileges
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=be464e...
Commit: be464e49a941f727812615107cbeeda119cf5669
Parent: 44f59b0698a3d82d3362da4c68a0d188f14f97da
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Oct 14 13:54:47 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Oct 14 13:54:47 2013 +0200
fence_vmware_soap: Correct error message when user does not have privileges
Previously, when an user does not have privileges to reboot a virtual machine, the
fence agent fails with python traceback. After applying this patch (by Shane Bradley),
the fence_vmware_soap fails with human readable error message.
Resolves: rhbz#1918263
---
fence/agents/lib/fencing.py.py | 4 +++-
fence/agents/vmware_soap/fence_vmware_soap.py | 17 +++++++++++++----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index d6b02d3..b2ab4be 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -24,6 +24,7 @@ EC_WAITING_OFF = 7
EC_STATUS = 8
EC_STATUS_HMC = 9
EC_PASSWORD_MISSING = 10
+EC_INVALID_PRIVILEGES = 11
TELNET_PATH = "/usr/bin/telnet"
SSH_PATH = "/usr/bin/ssh"
@@ -413,7 +414,8 @@ def fail(error_code):
EC_STATUS : "Failed: Unable to obtain correct plug status or plug is not available",
EC_STATUS_HMC :
"Failed: Either unable to obtain correct plug status, partition is not available or incorrect HMC version used",
- EC_PASSWORD_MISSING : "Failed: You have to set login password"
+ EC_PASSWORD_MISSING : "Failed: You have to set login password",
+ EC_INVALID_PRIVILEGES : "Failed: The user does not have the correct privileges to do the requested action."
}[error_code] + "\n"
sys.stderr.write(message)
syslog.syslog(syslog.LOG_ERR, message)
diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
index ac7f0d9..98ac011 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -156,10 +156,19 @@ def set_power_status(conn, options):
mo_machine = Property(vm.value)
mo_machine._type = "VirtualMachine"
- if options["--action"] == "on":
- conn.service.PowerOnVM_Task(mo_machine)
- else:
- conn.service.PowerOffVM_Task(mo_machine)
+ try:
+ if options["--action"] == "on":
+ conn.service.PowerOnVM_Task(mo_machine)
+ else:
+ conn.service.PowerOffVM_Task(mo_machine)
+ except WebFault, ex:
+ if ((str(ex).find("Permission to perform this operation was denied")) >= 0):
+ fail(EC_INVALID_PRIVILEGES)
+ else:
+ if options["--action"] == "on":
+ fail(EC_WAITING_ON)
+ else:
+ fail(EC_WAITING_OFF)
def remove_tmp_dir(tmp_dir):
shutil.rmtree(tmp_dir)
10 years, 6 months
fence-agents: master - fencing: Add schema for fence agents metadata (relax ng)
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=44f59b...
Commit: 44f59b0698a3d82d3362da4c68a0d188f14f97da
Parent: 94bd434ef6af6e42a8499b0985090cd4f6e89eb8
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu Oct 10 10:57:19 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Oct 10 10:57:19 2013 +0200
fencing: Add schema for fence agents metadata (relax ng)
Add a metadata schema which reflects current state. In order to simplify it
few minor changes were done to fence agents.
---
fence/agents/ipmilan/ipmilan.c | 3 +-
fence/agents/lib/metadata.rng | 65 +++++++++++++++++++++++++++++++++++
fence/agents/lpar/fence_lpar.py | 1 +
fence/agents/scsi/fence_scsi.pl | 1 +
fence/agents/virsh/fence_virsh.py | 1 +
fence/agents/xenapi/fence_xenapi.py | 1 +
make/fenceman.mk | 1 +
make/fencemanc.mk | 1 +
make/fencemanperl.mk | 1 +
9 files changed, 74 insertions(+), 1 deletions(-)
diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c
index 3561456..83029e3 100644
--- a/fence/agents/ipmilan/ipmilan.c
+++ b/fence/agents/ipmilan/ipmilan.c
@@ -915,10 +915,11 @@ static void print_xml_metadata(char *pname) {
"option (lanplus / -P) and increase wait after operation to "
"4 seconds (power_wait=4 / -T 4)");
printf("</longdesc>\n");
+ printf("<vendor-url>http://www.intel.com</vendor-url>\n");
printf("%s\n","<parameters>");
for (i=0;i<(sizeof(xml_parameters)/sizeof(struct xml_parameter_s));i++) {
- printf("\t<parameter name=\"%s\" unique=\"0\">\n",xml_parameters[i].name);
+ printf("\t<parameter name=\"%s\" unique=\"0\" required=\"%d\">\n",xml_parameters[i].name, xml_parameters[i].required);
printf("\t\t<getopt mixed=\"%s\" />\n",xml_parameters[i].getopt);
if (xml_parameters[i].default_value == NULL) {
diff --git a/fence/agents/lib/metadata.rng b/fence/agents/lib/metadata.rng
new file mode 100644
index 0000000..2566fee
--- /dev/null
+++ b/fence/agents/lib/metadata.rng
@@ -0,0 +1,65 @@
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+
+<start><element name="resource-agent">
+ <attribute name="name" />
+ <attribute name="shortdesc" />
+
+ <zeroOrMore>
+ <element name="symlink">
+ <attribute name="name" />
+ <attribute name="shortdesc" />
+ </element>
+ </zeroOrMore>
+
+ <element name="longdesc"> <text /> </element>
+ <element name="vendor-url"> <text /> </element>
+
+ <element name="parameters"> <oneOrMore>
+ <element name="parameter">
+ <attribute name="name" />
+ <attribute name="unique"> <ref name="boolean-values" /> </attribute>
+ <attribute name="required"> <ref name="boolean-values" /> </attribute>
+
+ <element name="getopt">
+ <attribute name="mixed" />
+ </element>
+ <element name="content">
+ <attribute name="type">
+ <choice>
+ <value>boolean</value>
+ <value>string</value>
+ </choice>
+ </attribute>
+ <optional>
+ <attribute name="default"> <text /> </attribute>
+ </optional>
+ </element>
+
+ <oneOrMore> <element name="shortdesc">
+ <attribute name="lang" />
+ <text />
+ </element> </oneOrMore>
+ </element>
+ </oneOrMore> </element>
+
+ <element name="actions"> <oneOrMore>
+ <element name="action">
+ <attribute name="name" />
+ <optional>
+ <attribute name="on_target"> <ref name="boolean-values" /> </attribute>
+ </optional>
+ <optional>
+ <attribute name="automatic"> <ref name="boolean-values" /> </attribute>
+ </optional>
+ </element>
+ </oneOrMore> </element>
+</element></start>
+
+<define name="boolean-values">
+ <choice>
+ <value>0</value>
+ <value>1</value>
+ </choice>
+</define>
+
+</grammar>
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index 9dc3e4d..6d2c649 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -133,6 +133,7 @@ def main():
docs = { }
docs["shortdesc"] = "Fence agent for IBM LPAR"
docs["longdesc"] = ""
+ docs["vendorurl"] = "http://www.ibm.com"
show_docs(options, docs)
if 0 == options.has_key("--managed"):
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 2585f9e..c959417 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -705,6 +705,7 @@ sub print_metadata ()
print "<resource-agent name=\"fence_scsi\"" .
" shortdesc=\"fence agent for SCSI-3 persistent reservations\">\n";
print "<longdesc>fence_scsi</longdesc>\n";
+ print "<vendor-url>http://www.t10.org</vendor-url>\n";
print "<parameters>\n";
print "\t<parameter name=\"aptpl\" unique=\"0\" required=\"0\">\n";
print "\t\t<getopt mixed=\"-a\"/>\n";
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index ccbd6e2..ac8dc7b 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -78,6 +78,7 @@ all work. \
\n.P\n\
By default, virsh needs root account to do properly work. So you \
must allow ssh login in your sshd_config."
+ docs["vendorurl"] = "http://libvirt.org"
show_docs(options, docs)
## Operate the fencing device
diff --git a/fence/agents/xenapi/fence_xenapi.py b/fence/agents/xenapi/fence_xenapi.py
index 7ba8533..064624a 100644
--- a/fence/agents/xenapi/fence_xenapi.py
+++ b/fence/agents/xenapi/fence_xenapi.py
@@ -214,6 +214,7 @@ It uses the XenAPI, supplied by Citrix, to establish an XML-RPC sesssion \
to a XenServer host. Once the session is established, further XML-RPC \
commands are issued in order to switch on, switch off, restart and query \
the status of virtual machines running on the host."
+ docs["vendorurl"] = "http://www.xenproject.org"
show_docs(options, docs)
xenSession = connect_and_login(options)
diff --git a/make/fenceman.mk b/make/fenceman.mk
index e6df9f0..d4f3b4e 100644
--- a/make/fenceman.mk
+++ b/make/fenceman.mk
@@ -2,6 +2,7 @@
set -e && \
PYTHONPATH=$(abs_srcdir)/../lib:$(abs_builddir)/../lib \
python $^ -o metadata > .$@.tmp && \
+ xmllint --noout --relaxng $(top_srcdir)/fence/agents/lib/metadata.rng .$@.tmp && \
xsltproc $(top_srcdir)/fence/agents/lib/fence2man.xsl .$@.tmp > $@
clean-man:
diff --git a/make/fencemanc.mk b/make/fencemanc.mk
index 9c904b6..27e1aae 100644
--- a/make/fencemanc.mk
+++ b/make/fencemanc.mk
@@ -1,6 +1,7 @@
%.8: $(TARGET) $(top_srcdir)/fence/agents/lib/fence2man.xsl
set -e && \
./$^ -o metadata > .$@.tmp && \
+ xmllint --noout --relaxng $(top_srcdir)/fence/agents/lib/metadata.rng .$@.tmp && \
xsltproc $(top_srcdir)/fence/agents/lib/fence2man.xsl .$@.tmp > $@
clean-man:
diff --git a/make/fencemanperl.mk b/make/fencemanperl.mk
index 74c1508..ed7c9cc 100644
--- a/make/fencemanperl.mk
+++ b/make/fencemanperl.mk
@@ -1,6 +1,7 @@
%.8: $(TARGET) $(top_srcdir)/fence/agents/lib/fence2man.xsl
set -e && \
perl $(TARGET) -o metadata > .$@.tmp && \
+ xmllint --noout --relaxng $(top_srcdir)/fence/agents/lib/metadata.rng .$@.tmp && \
xsltproc $(top_srcdir)/fence/agents/lib/fence2man.xsl .$@.tmp > $@
clean-man:
10 years, 6 months