Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=c5e6352c…
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
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=bef51987…
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.
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=38373e3b…
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:
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=1db6440e…
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) \
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=be464e49…
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)