FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 03-21-2011, 11:14 PM
Matt Clark
 
Default Changes to fencing.py

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):
 
Old 03-22-2011, 06:19 PM
Lon Hohberger
 
Default Changes to fencing.py

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.
 

Thread Tools




All times are GMT. The time now is 07:12 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org