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

[Xen-changelog] [xen-unstable] [XEND] Catch TypeErrors when unexpected SXP is encountered.



# HG changeset patch
# User Alastair Tse <atse@xxxxxxxxxxxxx>
# Node ID 8b91546569d75db4144ae76a76f35234fb92de28
# Parent  b2f5f1251330aca85644c38f5864b716f68565be
[XEND] Catch TypeErrors when unexpected SXP is encountered.

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendConfig.py |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff -r b2f5f1251330 -r 8b91546569d7 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Thu Nov 30 14:53:14 2006 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Thu Nov 30 15:19:01 2006 +0000
@@ -398,14 +398,14 @@ class XendConfig(dict):
         
         for key in extract_keys:
             val = sxp.child_value(sxp_cfg, key)
-            if val:
+            if val != None:
                 try:
-                    try:
-                        cfg[key] = LEGACY_CFG_TYPES[key](val)
-                    except KeyError:
-                        cfg[key] = val
-                except ValueError:
-                    pass
+                    cfg[key] = LEGACY_CFG_TYPES[key](val)
+                except KeyError:
+                    cfg[key] = val
+                except (TypeError, ValueError), e:
+                    log.warn("Unable to parse key %s: %s: %s" %
+                             (key, str(val), e))
 
         # Parsing the device SXP's. In most cases, the SXP looks
         # like this:
@@ -463,7 +463,7 @@ class XendConfig(dict):
         image_sxp = sxp.child_value(sxp_cfg, 'image', [])
         if image_sxp:
             image_vcpus = sxp.child_value(image_sxp, 'vcpus')
-            if image_vcpus is not None:
+            if image_vcpus != None:
                 try:
                     if 'vcpus_number' not in cfg:
                         cfg['vcpus_number'] = int(image_vcpus)

_______________________________________________
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®.