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

[Xen-changelog] [xen-3.4-testing] xend: pci: fix extract_the_exact_pci_names()



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1244460328 -3600
# Node ID 5e80a3ab4e1ec33992fe98789705395a1378041b
# Parent  a24e16539384c3de8c614d3212e4b58e4e28a3a5
xend: pci: fix extract_the_exact_pci_names()

Changeset 19726: d8b7b51f482b neglects the case pci_names could be
types.ListType.

Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>
xen-unstable changeset:   19739:4448fae52553
xen-unstable date:        Mon Jun 08 12:24:14 2009 +0100
---
 tools/python/xen/util/pci.py |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff -r a24e16539384 -r 5e80a3ab4e1e tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py      Fri Jun 05 09:44:05 2009 +0100
+++ b/tools/python/xen/util/pci.py      Mon Jun 08 12:25:28 2009 +0100
@@ -142,7 +142,14 @@ def parse_pci_name(pci_name_string):
 
 def extract_the_exact_pci_names(pci_names):
     result = []
-    pci_names = pci_names.split()
+
+    if isinstance(pci_names, types.StringTypes):
+        pci_names = pci_names.split()
+    elif isinstance(pci_names, types.ListType):
+        pci_names = re.findall(PCI_DEV_REG_EXPRESS_STR, '%s' % pci_names)
+    else:
+         raise PciDeviceParseError('Invalid argument: %s' % pci_names)
+
     for pci in pci_names:
         # The length of DDDD:bb:dd.f is 12.
         if len(pci) !=  12:
@@ -484,7 +491,7 @@ class PciDevice:
             return [self.name]
 
         dev_list = dev.find_all_devices_behind_the_bridge(ignore_bridge)
-        dev_list = extract_the_exact_pci_names('%s' % dev_list)
+        dev_list = extract_the_exact_pci_names(dev_list)
         return dev_list
 
     def do_secondary_bus_reset(self, target_bus, devs):

_______________________________________________
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®.