[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xend: fix hotplug for integrated devices



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1238495393 -3600
# Node ID b183684130fdd2ecab5c180c18c1e537c991ca6e
# Parent  46188402c2d9381c4aeb713e775ddc1e9b58c591
xend: fix hotplug for integrated devices

For integrated devices(with bus number 0), self.find_parent() returns
None, causing a python exception here.

Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>
---
 tools/python/xen/util/pci.py |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff -r 46188402c2d9 -r b183684130fd tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py      Tue Mar 31 11:28:49 2009 +0100
+++ b/tools/python/xen/util/pci.py      Tue Mar 31 11:29:53 2009 +0100
@@ -417,7 +417,10 @@ class PciDevice:
 
     def find_the_uppermost_pci_bridge(self):
         # Find the uppermost PCI/PCI-X bridge
-        (dom, b, d, f) = self.find_parent()
+        dev = self.find_parent()
+        if dev is None:
+            return None
+        (dom, b, d, f) = dev
         dev = dev_parent = PciDevice(dom, b, d, f)
         while dev_parent.dev_type != DEV_TYPE_PCIe_BRIDGE:
             parent = dev_parent.find_parent()
@@ -463,6 +466,11 @@ class PciDevice:
                 element,  the caller itself can remove it explicitly.
         '''
         dev = self.find_the_uppermost_pci_bridge()
+
+        # The 'self' device is on bus0.
+        if dev is None:
+            return [self.name]
+
         dev_list = dev.find_all_devices_behind_the_bridge(ignore_bridge)
         dev_list = re.findall(PCI_DEV_REG_EXPRESS_STR, '%s' % dev_list)
         return dev_list
@@ -559,7 +567,8 @@ class PciDevice:
             return self.find_all_the_multi_functions()
         elif self.dev_type == DEV_TYPE_PCI and not self.pci_af_flr:
             coassigned_pci_list = self.find_coassigned_pci_devices(True)
-            del coassigned_pci_list[0]
+            if len(coassigned_pci_list) > 1:
+                del coassigned_pci_list[0]
             return coassigned_pci_list
         else:
             return [self.name]

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.