From: Simon Horman <horms@verge.net.au>
To: xen-devel@lists.xensource.com
Cc: Tom Rotenberg <tom.rotenberg@gmail.com>
Subject: [patch] xend: pass-through: device state in xenstore may be null
Date: Mon, 27 Jul 2009 19:35:46 +1000 [thread overview]
Message-ID: <20090727093545.GA29786@verge.net.au> (raw)
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))
reply other threads:[~2009-07-27 9:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090727093545.GA29786@verge.net.au \
--to=horms@verge.net.au \
--cc=tom.rotenberg@gmail.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.