All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] xend: pass-through: device state in xenstore may be null
@ 2009-07-27  9:35 Simon Horman
  0 siblings, 0 replies; only message in thread
From: Simon Horman @ 2009-07-27  9:35 UTC (permalink / raw)
  To: xen-devel; +Cc: Tom Rotenberg

From: Tom Rotenberg <tom.rotenberg@gmail.com>

This patch was proposed by Tom Rotenberg to fix a bug that he found.

After devices are inserted into xenstore using _createDevices()
they may not have a state entry. This is a problem for cleanupDevices()
which is called when PCI devices are passed-through.

This patch seems to be correct as with it applied cleanupDevices() simply
ignores the state if it is unknown.

The confusing part about this problem is that on Tom's system devices don't
have state entries and on my system they have have state=3 (Initialised).
The latter seems to be wrong.

Error Log:

Traceback (most recent call last):
  File "usr/lib/python2.5/site-packages/xen/xend/XendDomainInfo.py", line 99, in create
    vm.start()
  File "usr/lib/python2.5/site-packages/xen/xend/XendDomainInfo.py", line 459, in start
    XendTask.log_progress(31, 60, self._initDomain)
  File "usr/lib/python2.5/site-packages/xen/xend/XendTask.py", line 209, in log_progress
    retval = func(*args, **kwds)
  File "usr/lib/python2.5/site-packages/xen/xend/XendDomainInfo.py", line 2544, in _initDomain
    self._createDevices()
  File "usr/lib/python2.5/site-packages/xen/xend/XendDomainInfo.py", line 2170, in _createDevices
    self.pci_device_configure_boot()
  File "usr/lib/python2.5/site-packages/xen/xend/XendDomainInfo.py", line 594, in pci_device_configure_boot
    self.pci_device_configure(dev_sxp)
  File "usr/lib/python2.5/site-packages/xen/xend/XendDomainInfo.py", line 876, in pci_device_configure
    num_devs = dev_control.cleanupDevice(devid)
  File "usr/lib/python2.5/site-packages/xen/xend/server/pciif.py", line 502, in cleanupDevice
    state = int(self.readBackend(devid, 'state-%i' % i))
TypeError: int() argument must be a string or a number, not 'NoneType'

Cc: Tom Rotenberg <tom.rotenberg@gmail.com>
Signed-off-by: Tom Rotenberg <tom.rotenberg@gmail.com>

--- 

This patch is applicable to the pass-through backport to xen-3.4-testing.
Accordingly I have pushed it to the following trees:

* http://hg.vergenet.net/xen/xen-3.4-testing-pass-through-multi-function/
* http://hg.vergenet.net/xen/xen-3.4-testing-pass-through/

It is also applicable to xen-unstable.hg.

Index: xen-unstable.hg/tools/python/xen/xend/server/pciif.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xend/server/pciif.py	2009-07-14 15:12:46.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xend/server/pciif.py	2009-07-27 18:55:14.000000000 +1000
@@ -489,7 +489,11 @@ class PciController(DevController):
         num_devs = int(self.readBackend(devid, 'num_devs'))
         new_num_devs = 0
         for i in range(num_devs):
-            state = int(self.readBackend(devid, 'state-%i' % i))
+            try:
+                state = int(self.readBackend(devid, 'state-%i' % i))
+            except:
+                state = xenbusState['Unknown']
+
             if state == xenbusState['Closing']:
                 # Detach I/O resources.
                 pci_dev = parse_pci_name(self.readBackend(devid, 'dev-%i' % i))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-07-27  9:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-27  9:35 [patch] xend: pass-through: device state in xenstore may be null Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.