* [Cluster-devel] Changes to fencing.py
@ 2011-03-22 0:14 Matt Clark
2011-03-22 19:19 ` Lon Hohberger
0 siblings, 1 reply; 2+ messages in thread
From: Matt Clark @ 2011-03-22 0:14 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
I sent an email a little while about a fencing agent script I was writing to handle Citrix XenServer virtual machine (and apparently XCP virtual machine). I think I am pretty close to finishing this off as I haven't made any code changes in a few weeks. Usually a good sign it's at least ready for others to test/play with.
I had to make the following changes to the fencing library. Feedback welcome.
Script source (fence_cxs_redhat.py) available athttp://code.google.com/p/fence-xenserver/downloads/list
Thanks,
Matt.
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.pyindex 4e5eb18..0ea2979 100644--- a/fence/agents/lib/fencing.py.py+++ b/fence/agents/lib/fencing.py.py@@ -378,7 +378,28 @@ all_opt = { "default" : "1", "required" : "0", "shortdesc" : "Count of attempts to retry power on",- "order" : 201 }+ "order" : 201 },+ "session_url" : {+ "getopt" : "s:",+ "longopt" : "session-url",+ "help" : "-s, --session-url URL to connect to XenServer on.",+ "required" : "1",+ "shortdesc" : "The URL of the XenServer host.",+ "order" : 1},+ "vm_name" : {+ "getopt" : "n:",+ "longopt" : "vm-name",+ "help" : "-n, --vm-name Name of the VM to fence.",+ "required" : "0",+ "shortdesc" : "The name of the virual machine to fence.",+ "order" : 1},+ "uuid" : {+ "getopt" : "U:",+ "longopt" : "uuid",+ "help" : "-U, --uuid UUID of the VM to fence.",+ "required" : "0",+ "shortdesc" : "The UUID of the virtual machine to fence.",+ "order" : 1} } common_opt = [ "retry_on", "delay" ]@@ -661,7 +682,7 @@ def check_input(device_opt, opt): if (0 == options.has_key("-l")) and device_opt.count("login") and (device_opt.count("no_login") == 0): fail_usage("Failed: You have to set login name") - if 0 == options.has_key("-a"):+ if 0 == options.has_key("-a") and 0 == options.has_key("-s"): fail_usage("Failed: You have to enter fence address") if (device_opt.count("no_password") == 0):@@ -682,6 +703,10 @@ def check_input(device_opt, opt): if (0 == ["list", "monitor"].count(options["-o"].lower())) and (0 == options.has_key("-n")) and (device_opt.count("port")): fail_usage("Failed: You have to enter plug number") + if (0 == ["list", "monitor"].count(options["-o"].lower())) and device_opt.count("vm_name") and device_opt.count("uuid"):+ if 0 == options.has_key("-n") and 0 == options.has_key("-U"):+ fail_usage("Failed: You must specify either UUID or VM name")+ if options.has_key("-S"): options["-p"] = os.popen(options["-S"]).read().rstrip() @@ -745,7 +770,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None ## Process options that manipulate fencing device #####- if (options["-o"] == "list") and (0 == options["device_opt"].count("port")) and (0 == options["device_opt"].count("partition")):+ if (options["-o"] == "list") and (0 == options["device_opt"].count("port")) and (0 == options["device_opt"].count("partition")) and (0 == options["device_opt"].count("uuid")): print "N/A" return elif (options["-o"] == "list" and get_outlet_list == None):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20110322/ac071ce7/attachment.htm>
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Cluster-devel] Changes to fencing.py
2011-03-22 0:14 [Cluster-devel] Changes to fencing.py Matt Clark
@ 2011-03-22 19:19 ` Lon Hohberger
0 siblings, 0 replies; 2+ messages in thread
From: Lon Hohberger @ 2011-03-22 19:19 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Tue, Mar 22, 2011 at 11:14:07AM +1100, Matt Clark wrote:
>
> Hi,
> I sent an email a little while about a fencing agent script I was writing to handle Citrix XenServer virtual machine (and apparently XCP virtual machine). I think I am pretty close to finishing this off as I haven't made any code changes in a few weeks. Usually a good sign it's at least ready for others to test/play with.
> I had to make the following changes to the fencing library. Feedback welcome.
> Script source (fence_cxs_redhat.py) available athttp://code.google.com/p/fence-xenserver/downloads/list
> Thanks,
> Matt.
Your patch formatted on one line for some reason; can you just do a 'git
send-email' on your patch to resend it?
--
Lon Hohberger - Red Hat, Inc.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-22 19:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-22 0:14 [Cluster-devel] Changes to fencing.py Matt Clark
2011-03-22 19:19 ` Lon Hohberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).