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

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



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1268157929 0
# Node ID 14704aeaeec80d246c448bd4668a4ed2b02f181c
# Parent  6063c16aeeaa85bed0b34606e11a0e939384a754
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>
xen-unstable changeset:   20995:6c338a5830b5
xen-unstable date:        Wed Mar 03 17:40:22 2010 +0000
---
 tools/python/xen/xm/xenapi_create.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff -r 6063c16aeeaa -r 14704aeaeec8 tools/python/xen/xm/xenapi_create.py
--- a/tools/python/xen/xm/xenapi_create.py      Tue Mar 02 19:22:22 2010 +0000
+++ b/tools/python/xen/xm/xenapi_create.py      Tue Mar 09 18:05:29 2010 +0000
@@ -624,11 +624,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®.