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

[Xen-bugs] [Bug 1680] New: Xend fails to start if /var/lib/xend/state/*.

To: xen-bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-bugs] [Bug 1680] New: Xend fails to start if /var/lib/xend/state/*.xml are empty
From: bugzilla-daemon@xxxxxxxxxxxxxxxxxxx
Date: Tue, 2 Nov 2010 23:26:03 -0700
Delivery-date: Tue, 02 Nov 2010 23:26:12 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-bugs-request@lists.xensource.com?subject=help>
List-id: Xen Bugzilla <xen-bugs.lists.xensource.com>
List-post: <mailto:xen-bugs@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-bugs>, <mailto:xen-bugs-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-bugs>, <mailto:xen-bugs-request@lists.xensource.com?subject=unsubscribe>
Reply-to: bugs@xxxxxxxxxxxxxxxxxx
Sender: xen-bugs-bounces@xxxxxxxxxxxxxxxxxxx
http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1680

           Summary: Xend fails to start if /var/lib/xend/state/*.xml are
                    empty
           Product: Xen
           Version: unstable
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Tools
        AssignedTo: xen-bugs@xxxxxxxxxxxxxxxxxxx
        ReportedBy: shinji@xxxxxxxxxxxx


When attempting to start Xend, an ExpatError will be thrown if any of
/var/lib/xend/state/*.xml are empty.

Steps to reproduce:
    1. Stop Xend
    2. Truncate a /var/lib/xend/state/*.xml file to 0 bytes
    3. Start Xend

Actual results:
    An ExpatError is thrown

Expected results:
    Xend starts

Build information:
    Xend changeset: Wed Aug 25 09:22:42 2010 +0100 21324:b536ebfba183.
    Python 2.6.6 (r266:84292, Nov  3 2010, 03:49:31)
    Gentoo Linux (x86_64)



Fix:

The problem is at xen/xend/XendStateStore.py:101:

        if not os.path.exists(xml_path):
            return {}

        dom = minidom.parse(xml_path)

The code checks that the file exists, but minidom.parse() can still fail with
an ExpatError if the file is empty. A quick fix could be to add after exists()
check (untested, maybe the file needs to be removed for later code to recreate
it?):

        if os.path.getsize(xml_path) == 0:
            return {}

but perhaps a more thorough solution that catches invalid XML files might be
more appropriate.



xend.log excerpt:

[2010-11-03 05:34:57 2565] INFO (SrvDaemon:332) Xend Daemon started
[2010-11-03 05:34:57 2565] INFO (SrvDaemon:336) Xend changeset: Wed Aug 25
09:22:42 2010 +0100 21324:b536ebfba183.
[2010-11-03 05:34:57 2565] ERROR (SrvDaemon:349) Exception starting xend (no
element found: line 1, column 0)
Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/xen/xend/server/SrvDaemon.py", line
341, in run
    servers = SrvServer.create()
  File "/usr/lib64/python2.6/site-packages/xen/xend/server/SrvServer.py", line
251, in create
    root.putChild('xend', SrvRoot())
  File "/usr/lib64/python2.6/site-packages/xen/xend/server/SrvRoot.py", line
40, in __init__
    self.get(name)
  File "/usr/lib64/python2.6/site-packages/xen/web/SrvDir.py", line 84, in get
    val = val.getobj()
  File "/usr/lib64/python2.6/site-packages/xen/web/SrvDir.py", line 52, in
getobj
    self.obj = klassobj()
  File "/usr/lib64/python2.6/site-packages/xen/xend/server/SrvNode.py", line
30, in __init__
    self.xn = XendNode.instance()
  File "/usr/lib64/python2.6/site-packages/xen/xend/XendNode.py", line 1140, in
instance
    inst = XendNode()
  File "/usr/lib64/python2.6/site-packages/xen/xend/XendNode.py", line 70, in
__init__
    saved_host = self.state_store.load_state('host')


-- 
Configure bugmail: 
http://bugzilla.xensource.com/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-bugs] [Bug 1680] New: Xend fails to start if /var/lib/xend/state/*.xml are empty, bugzilla-daemon <=