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-devel

[Xen-devel] [PATCH] BZ 1680: Xend fails to start if /var/lib/xend/state/

To: xen-devel@xxxxxxxxxxxxxxxxxxx, Ian.Jackson@xxxxxxxxxxxxx, Ian.Campbell@xxxxxxxxxx, m.a.young@xxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] BZ 1680: Xend fails to start if /var/lib/xend/state/*.xml are empty
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Thu, 03 Nov 2011 12:04:23 -0400
Cc:
Delivery-date: Thu, 03 Nov 2011 09:21:02 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.9.3
# HG changeset patch
# User Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
# Date 1320336164 14400
# Node ID 76391f599433544ecf3f606e9d4997967d5d6cd4
# Parent  54a5e994a241a506900ee0e197bb42e5f1d8e759
BZ 1680: Xend fails to start if /var/lib/xend/state/*.xml are empty

which I get often when replacing the Xen hypervisor with a newer version.

This can be easily be reproduced under Fedora Core 16 by installing
xen RPMs and then replacing the xen.gz with a newer version.

/var/log/xen/xend.log reports:

[2011-11-03 09:45:55 1368] ERROR (SrvDaemon:356) Exception starting xend (no 
element found: line 1, column 0)
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/xen/xend/server/SrvDaemon.py", line 
348, in run
    servers = SrvServer.create()
  File "/usr/lib64/python2.7/site-packages/xen/xend/server/SrvServer.py", line 
258, in create
    root.putChild('xend', SrvRoot())
  File "/usr/lib64/python2.7/site-packages/xen/xend/server/SrvRoot.py", line 
40, in __init__
    self.get(name)
  File "/usr/lib64/python2.7/site-packages/xen/web/SrvDir.py", line 84, in get
    val = val.getobj()
  File "/usr/lib64/python2.7/site-packages/xen/web/SrvDir.py", line 52, in 
getobj
    self.obj = klassobj()
  File "/usr/lib64/python2.7/site-packages/xen/xend/server/SrvNode.py", line 
30, in __init__
    self.xn = XendNode.instance()
  File "/usr/lib64/python2.7/site-packages/xen/xend/XendNode.py", line 1181, in 
instance
    inst = XendNode()
  File "/usr/lib64/python2.7/site-packages/xen/xend/XendNode.py", line 71, in 
__init__
    saved_host = self.state_store.load_state('host')
  File "/usr/lib64/python2.7/site-packages/xen/xend/XendStateStore.py", line 
104, in load_state
    dom = minidom.parse(xml_path)
  File "/usr/lib64/python2.7/site-packages/_xmlplus/dom/minidom.py", line 1915, 
in parse
    return expatbuilder.parse(file)
  File "/usr/lib64/python2.7/site-packages/_xmlplus/dom/expatbuilder.py", line 
926, in parse
    result = builder.parseFile(fp)
  File "/usr/lib64/python2.7/site-packages/_xmlplus/dom/expatbuilder.py", line 
211, in parseFile
    parser.Parse("", True)
ExpatError: no element found: line 1, column 0

And with this patch, the problem disappears

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Signed-off-by: Anthony Low <shinji@xxxxxxxxxxxx>

diff -r 54a5e994a241 -r 76391f599433 tools/python/xen/xend/XendStateStore.py
--- a/tools/python/xen/xend/XendStateStore.py   Wed Nov 02 17:09:09 2011 +0000
+++ b/tools/python/xen/xend/XendStateStore.py   Thu Nov 03 12:02:44 2011 -0400
@@ -101,6 +101,9 @@ class XendStateStore:
         if not os.path.exists(xml_path):
             return {}
 
+        if not os.path.getsize(xml_path) == 0:
+            return {}
+
         dom = minidom.parse(xml_path)
         root = dom.documentElement
         state = {}



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

<Prev in Thread] Current Thread [Next in Thread>