ia64/xen-unstable

changeset 19739:4448fae52553

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@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jun 08 12:24:14 2009 +0100 (2009-06-08)
parents 8dd5c3cae086
children 112680f620bf
files tools/python/xen/util/pci.py
line diff
     1.1 --- a/tools/python/xen/util/pci.py	Fri Jun 05 14:04:03 2009 +0100
     1.2 +++ b/tools/python/xen/util/pci.py	Mon Jun 08 12:24:14 2009 +0100
     1.3 @@ -155,7 +155,14 @@ def parse_pci_name(pci_name_string):
     1.4  
     1.5  def extract_the_exact_pci_names(pci_names):
     1.6      result = []
     1.7 -    pci_names = pci_names.split()
     1.8 +
     1.9 +    if isinstance(pci_names, types.StringTypes):
    1.10 +        pci_names = pci_names.split()
    1.11 +    elif isinstance(pci_names, types.ListType):
    1.12 +        pci_names = re.findall(PCI_DEV_REG_EXPRESS_STR, '%s' % pci_names)
    1.13 +    else:
    1.14 +         raise PciDeviceParseError('Invalid argument: %s' % pci_names)
    1.15 +
    1.16      for pci in pci_names:
    1.17          # The length of DDDD:bb:dd.f is 12.
    1.18          if len(pci) !=  12:
    1.19 @@ -503,7 +510,7 @@ class PciDevice:
    1.20              return [self.name]
    1.21  
    1.22          dev_list = dev.find_all_devices_behind_the_bridge(ignore_bridge)
    1.23 -        dev_list = extract_the_exact_pci_names('%s' % dev_list)
    1.24 +        dev_list = extract_the_exact_pci_names(dev_list)
    1.25          return dev_list
    1.26  
    1.27      def do_secondary_bus_reset(self, target_bus, devs):