WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [XEND] Catch TypeErrors when unexpected S

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEND] Catch TypeErrors when unexpected SXP is encountered.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 30 Nov 2006 21:30:35 +0000
Delivery-date: Thu, 30 Nov 2006 13:31:25 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XEND] Catch TypeErrors when unexpected SXP is encountered., Xen patchbot-unstable <=