[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xen-bugs
Subject:    [Xen-bugs] [Bug 1680] New: Xend fails to start if
From:       bugzilla-daemon () lists ! xensource ! com
Date:       2010-11-03 6:26:03
Message-ID: bug-1680-3 () http ! bugzilla ! xensource ! com/bugzilla/
[Download RAW message or body]

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@lists.xensource.com
        ReportedBy: shinji@pikopiko.org


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@lists.xensource.com
http://lists.xensource.com/xen-bugs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic