* [PATCH] fix domain exit actions that contain hyphen
@ 2010-03-02 22:55 Jim Fehlig
0 siblings, 0 replies; only message in thread
From: Jim Fehlig @ 2010-03-02 22:55 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 1501 bytes --]
Domain exit actions that contain a hyphen (e.g. rename-restart) were not
being detected properly when xm is configured to use xenapi. Domain
config containing on_crash="rename-restart" results in
xen53:~ # xm new /tmp/domU.config
Using config file "/tmp/domU.config".
Unexpected error: <type 'exceptions.TypeError'>
Please report to xen-devel@lists.xensource.com
Traceback (most recent call last):
File "/usr/sbin/xm", line 7, in <module>
main.main(sys.argv)
File "/usr/lib64/python2.6/site-packages/xen/xm/main.py", line 3937,
in main
_, rc = _run_cmd(cmd, cmd_name, args)
File "/usr/lib64/python2.6/site-packages/xen/xm/main.py", line 3961,
in _run_cmd
return True, cmd(args)
File "<string>", line 1, in <lambda>
File "/usr/lib64/python2.6/site-packages/xen/xm/main.py", line 1582,
in xm_importcommand
cmd.main([command] + args)
File "/usr/lib64/python2.6/site-packages/xen/xm/new.py", line 69, in main
doc = sxp2xml_inst.convert_sxp_to_xml(config)
File "/usr/lib64/python2.6/site-packages/xen/xm/xenapi_create.py",
line 680, in convert_sxp_to_xml
XEN_API_ON_CRASH_BEHAVIOUR)
File "/usr/lib64/python2.6/site-packages/xen/xm/xenapi_create.py",
line 671, in conv_chk
raise "Invalid value: " + val
TypeError: exceptions must be classes or instances, not str
The attached patch fixes the raised exception and at the same time
handles the replacement of hyphen with underscore properly.
Regards,
Jim
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
[-- Attachment #2: xm-fix.patch --]
[-- Type: text/x-patch, Size: 855 bytes --]
Index: xen-4.0.0-testing/tools/python/xen/xm/xenapi_create.py
===================================================================
--- xen-4.0.0-testing.orig/tools/python/xen/xm/xenapi_create.py
+++ xen-4.0.0-testing/tools/python/xen/xm/xenapi_create.py
@@ -666,11 +666,11 @@ class sxp2xml:
= get_child_by_name(config, "on_crash", "restart")
def conv_chk(val, vals):
- val.replace("-", "_")
- if val not in vals:
- raise "Invalid value: " + val
+ lval = val.replace("-", "_")
+ if lval not in vals:
+ raise ValueError("Invalid value: %s" % val)
else:
- return val
+ return lval
actions_after_shutdown = conv_chk(actions_after_shutdown,\
XEN_API_ON_NORMAL_EXIT)
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-03-02 22:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-02 22:55 [PATCH] fix domain exit actions that contain hyphen Jim Fehlig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.