ia64/xen-unstable

changeset 19789:cf6d3211ec59

xend: pci: find_parent: should return string rather than int

Using changeset 19783: 61ec78692b13, device assignment can't work:
e.g., in find_the_uppermost_pci_bridge(),
parent = dev_parent.find_parent()
...
dev_parent = PciDevice(parent),
we can see parent['domain'] is int and in PciDevice's __init__,
int(dev['domain'], 16) would fail:
TypeError: int() can't convert non-string with explicit base

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 18 10:18:10 2009 +0100 (2009-06-18)
parents 2f9e1348aa98
children 01ad2654815a
files tools/python/xen/util/pci.py
line diff
     1.1 --- a/tools/python/xen/util/pci.py	Thu Jun 18 10:14:16 2009 +0100
     1.2 +++ b/tools/python/xen/util/pci.py	Thu Jun 18 10:18:10 2009 +0100
     1.3 @@ -547,12 +547,12 @@ class PciDevice:
     1.4              else:
     1.5                  dev = {}
     1.6                  lst = parent.split(':')
     1.7 -                dev['domain'] = int(lst[0], 16)
     1.8 -                dev['bus'] = int(lst[1], 16)
     1.9 +                dev['domain'] = '%04x' % int(lst[0], 16)
    1.10 +                dev['bus'] = '%02x' % int(lst[1], 16)
    1.11                  lst = lst[2]
    1.12                  lst = lst.split('.')
    1.13 -                dev['slot'] = int(lst[0], 16)
    1.14 -                dev['func'] = int(lst[1], 16)
    1.15 +                dev['slot'] = '%02x' % int(lst[0], 16)
    1.16 +                dev['func'] = '%x' % int(lst[1], 16)
    1.17              return dev
    1.18          except OSError, (errno, strerr):
    1.19              raise PciDeviceParseError('Can not locate the parent of %s',