Mailing List Archive

[PATCH] BZ 1680: Xend fails to start if /var/lib/xend/state/*.xml are empty
# HG changeset patch
# User Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
# 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@oracle.com>
Signed-off-by: Anthony Low <shinji@pikopiko.org>

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@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH] BZ 1680: Xend fails to start if /var/lib/xend/state/*.xml are empty [ In reply to ]
Konrad Rzeszutek Wilk writes ("[Xen-devel] [PATCH] BZ 1680: Xend fails to start if /var/lib/xend/state/*.xml are empty"):
> BZ 1680: Xend fails to start if /var/lib/xend/state/*.xml are empty

We're not really maintaining xend any more but this change is at the
very worst harmless and I have applied it.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH] BZ 1680: Xend fails to start if /var/lib/xend/state/*.xml are empty [ In reply to ]
On Mon, Nov 14, 2011 at 05:55:25PM +0000, Ian Jackson wrote:
> Konrad Rzeszutek Wilk writes ("[Xen-devel] [PATCH] BZ 1680: Xend fails to start if /var/lib/xend/state/*.xml are empty"):
> > BZ 1680: Xend fails to start if /var/lib/xend/state/*.xml are empty
>
> We're not really maintaining xend any more but this change is at the
> very worst harmless and I have applied it.

Thanks Ian.

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