Skip to contentSkip to conversation

reports of xend not starting

PATCH Jim Fehlig 1 participant 1 message Mar 22, 2010

lore
Share & tools
lore

Jim Fehlig

author
#0 lore raw

Hi,

I received reports of xend not starting with following traceback:

[2010-03-22 14:11:56 4943] ERROR (SrvDaemon:349) Exception starting xend (ord() expected a character, but string of length 0 found)
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
261, 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 1191, in
instance
inst = XendNode()
File "/usr/lib64/python2.6/site-packages/xen/xend/XendNode.py", line 159, in
__init__

    self._init_PPCIs()

File "/usr/lib64/python2.6/site-packages/xen/xend/XendNode.py", line 282, in
_init_PPCIs
for pci_dev in PciUtil.get_all_pci_devices():
File "/usr/lib64/python2.6/site-packages/xen/util/pci.py", line 469, in
get_all_pci_devices
return map(PciDevice, get_all_pci_dict())
File "/usr/lib64/python2.6/site-packages/xen/util/pci.py", line 693, in
__init__
self.get_info_from_sysfs()
File "/usr/lib64/python2.6/site-packages/xen/util/pci.py", line 1256, in
get_info_from_sysfs

    self.find_capability(0x11)

File "/usr/lib64/python2.6/site-packages/xen/util/pci.py", line 1229, in
find_capability
capa_pointer = ord(conf_file.read(1))
TypeError: ord() expected a character, but string of length 0 found [2010-03-22 14:11:56 4942] INFO (SrvDaemon:220) Xend exited with status 1.

I won't pretend to know the code but looks like some protection against read() returning an empty string (EOF) is in order. Is the attached patch appropriate?

Regards,
Jim

tools/python/xen/util/pci.py +3 -0
Index: xen-4.0.0-testing/tools/python/xen/util/pci.py
===================================================================
@@ -1251,6 +1251,9 @@ class PciDevice:
         except IOError, (errno, strerr):
             raise PciDeviceParseError(('Failed to locate sysfs mount: %s: %s (%d)' %
                 (PROC_PCI_PATH, strerr, errno)))
+        except TypeError, err:
+            log.debug("Caught TypeError '%s'" % err)
+            pass
 
     def get_info_from_sysfs(self):
         self.find_capability(0x11)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel