debuggers.hg

changeset 21041:6c338a5830b5

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@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Mar 03 17:40:22 2010 +0000 (2010-03-03)
parents 71af69a9d393
children 401c0012b827
files tools/python/xen/xm/xenapi_create.py
line diff
     1.1 --- a/tools/python/xen/xm/xenapi_create.py	Wed Mar 03 17:39:22 2010 +0000
     1.2 +++ b/tools/python/xen/xm/xenapi_create.py	Wed Mar 03 17:40:22 2010 +0000
     1.3 @@ -664,11 +664,11 @@ class sxp2xml:
     1.4              = get_child_by_name(config, "on_crash", "restart")
     1.5  
     1.6          def conv_chk(val, vals):
     1.7 -            val.replace("-", "_")
     1.8 -            if val not in vals:
     1.9 -                raise "Invalid value: " + val
    1.10 +            lval = val.replace("-", "_")
    1.11 +            if lval not in vals:
    1.12 +                raise ValueError("Invalid value: %s" % val)
    1.13              else:
    1.14 -                return val
    1.15 +                return lval
    1.16  
    1.17          actions_after_shutdown = conv_chk(actions_after_shutdown,\
    1.18                                            XEN_API_ON_NORMAL_EXIT)