[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Fix domain exit actions that contain hyphen



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1267638022 0
# Node ID 6c338a5830b524a17290285fd02fa442927b1d52
# Parent  71af69a9d393aaefb22e90342aa0a0cf86aabe53
Fix domain exit actions that contain hyphen

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=3D"rename-restart" results in

xen53:~ # xm new /tmp/domU.config
Using config file "/tmp/domU.config".
Unexpected error: <type 'exceptions.TypeError'>

This patch fixes the raised exception and at the same time
handles the replacement of hyphen with underscore properly.

Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxxxx>
---
 tools/python/xen/xm/xenapi_create.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff -r 71af69a9d393 -r 6c338a5830b5 tools/python/xen/xm/xenapi_create.py
--- a/tools/python/xen/xm/xenapi_create.py      Wed Mar 03 17:39:22 2010 +0000
+++ b/tools/python/xen/xm/xenapi_create.py      Wed Mar 03 17:40:22 2010 +0000
@@ -664,11 +664,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)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.