fence-agents: master - fencing: Monitor is not working correctly without 'list' or 'status'

Marek GrĂ¡c marx at fedoraproject.org
Tue Jul 1 13:29:33 UTC 2014


Gitweb:        http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=02bdd80e1077441aa2d50ef823068120a0a92725
Commit:        02bdd80e1077441aa2d50ef823068120a0a92725
Parent:        c2f2ecdab12da4582509b00b18972b3da7a5cee4
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Tue Jul 1 15:27:27 2014 +0200
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Tue Jul 1 15:27:27 2014 +0200

fencing: Monitor is not working correctly without 'list' or 'status'

Action monitor either executes 'status' (without --plug) or 'list' (with --plug). But
it is not required to have 'list' action. If they do not then 'monitor' has to be done
in different way, e.g. login/logout.
---
 fence/agents/ovh/fence_ovh.py         |   13 ++++++++++---
 fence/agents/raritan/fence_raritan.py |    5 ++++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/fence/agents/ovh/fence_ovh.py b/fence/agents/ovh/fence_ovh.py
index f9a1c39..14a0706 100644
--- a/fence/agents/ovh/fence_ovh.py
+++ b/fence/agents/ovh/fence_ovh.py
@@ -94,10 +94,10 @@ Poweroff is simulated with a reboot into rescue-pro mode."
 	docs["vendorurl"] = "http://www.ovh.net"
 	show_docs(options, docs)
 
-	if options["--action"] in ["list", "status"]:
-		fail_usage("Action '" + options["--action"] + "' is not supported in this fence agent")
+	if options["--action"] == "list":
+		fail_usage("Action 'list' is not supported in this fence agent")
 
-	if not options["--plug"].endswith(".ovh.net"):
+	if options["--action"] != "monitor" and not options["--plug"].endswith(".ovh.net"):
 		options["--plug"] += ".ovh.net"
 
 	if not options.has_key("--email"):
@@ -107,6 +107,13 @@ Poweroff is simulated with a reboot into rescue-pro mode."
 
 	conn = soap_login(options)
 
+	if options["--action"] == 'monitor':
+		try:
+			conn.service.logout(options["session"])
+		except Exception:
+			pass
+		sys.exit(0)
+
 	# Save datetime just before changing netboot
 	before_netboot_reboot = datetime.now()
 
diff --git a/fence/agents/raritan/fence_raritan.py b/fence/agents/raritan/fence_raritan.py
index 3506e25..bb6ad52 100644
--- a/fence/agents/raritan/fence_raritan.py
+++ b/fence/agents/raritan/fence_raritan.py
@@ -79,7 +79,10 @@ block any necessary fencing actions."
 	except pexpect.TIMEOUT:
 		fail(EC_LOGIN_DENIED)
 
-	result = fence_action(conn, options, set_power_status, get_power_status)
+	result = 0
+	if options["--action"] != "monitor":
+		result = fence_action(conn, options, set_power_status, get_power_status)
+
 	fence_logout(conn, "exit\n")
 	sys.exit(result)
 


More information about the cluster-commits mailing list