BZ 1680: Xend fails to start if /var/lib/xend/state/*.xml are empty
PATCH 1/1 BZ 1680: Xend fails to start if /var/lib/xend/state/*.xml are empty
# HG changeset patch
# User Konrad Rzeszutek Wilk <[email protected]>
# 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
tools/python/xen/xend/XendStateStore.py +3 -0
@@ -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 = {}
Konrad Rzeszutek Wilk writes ("[Xen-devel] [PATCH] BZ 1680: Xend fails to start if /var/lib/xend/state/*.xml are empty"):
Quoted 1 line
BZ 1680: Xend fails to start if
/var/lib/xend/state/*.xmlare 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.
Quoted 5 lines · Ian Jackson
Konrad Rzeszutek Wilk writes ("[Xen-devel] [PATCH] BZ 1680: Xend fails to start if
/var/lib/xend/state/*.xmlare empty"):Quoted 1 line
BZ 1680: Xend fails to start if
/var/lib/xend/state/*.xmlare emptyWe're not really maintaining xend any more but this change is at the very worst harmless and I have applied it.
Thanks Ian.