ia64/xen-unstable

changeset 19782:902df7680e2e

xend: pass-through: Use common parsing code in getDeviceConfiguration()

Signed-off-by: Simon Horman <horms@verge.net.au>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jun 17 07:39:03 2009 +0100 (2009-06-17)
parents 85fdfb7da88c
children 61ec78692b13
files tools/python/xen/xend/server/pciif.py
line diff
     1.1 --- a/tools/python/xen/xend/server/pciif.py	Wed Jun 17 07:38:42 2009 +0100
     1.2 +++ b/tools/python/xen/xend/server/pciif.py	Wed Jun 17 07:39:03 2009 +0100
     1.3 @@ -170,31 +170,18 @@ class PciController(DevController):
     1.4          pci_devs = []
     1.5  
     1.6          for i in range(int(num_devs)):
     1.7 -            dev_config = self.readBackend(devid, 'dev-%d' % i)
     1.8 +            pci_dev = parse_pci_name(self.readBackend(devid, 'dev-%d' % i))
     1.9  
    1.10 -            pci_match = re.match(r"((?P<domain>[0-9a-fA-F]{1,4})[:,])?" +
    1.11 -                                 r"(?P<bus>[0-9a-fA-F]{1,2})[:,]" + 
    1.12 -                                 r"(?P<slot>[0-9a-fA-F]{1,2})[.,]" + 
    1.13 -                                 r"(?P<func>[0-7]{1,2})$", dev_config)
    1.14 -            
    1.15 -            if pci_match!=None:
    1.16 -                pci_dev_info = pci_match.groupdict()
    1.17 -                dev_dict = {'domain': '0x%(domain)s' % pci_dev_info,
    1.18 -                                 'bus': '0x%(bus)s' % pci_dev_info,
    1.19 -                                 'slot': '0x%(slot)s' % pci_dev_info,
    1.20 -                                 'func': '0x%(func)s' % pci_dev_info}
    1.21 +            # Per device uuid info
    1.22 +            pci_dev['uuid'] = self.readBackend(devid, 'uuid-%d' % i)
    1.23 +            pci_dev['vslot'] = '0x%s' % self.readBackend(devid, 'vslot-%d' % i)
    1.24  
    1.25 -                # Per device uuid info
    1.26 -                dev_dict['uuid'] = self.readBackend(devid, 'uuid-%d' % i)
    1.27 -                dev_dict['vslot'] = '0x%s' % \
    1.28 -                                    self.readBackend(devid, 'vslot-%d' % i)
    1.29 +            #append opts info
    1.30 +            opts = self.readBackend(devid, 'opts-%d' % i)
    1.31 +            if opts is not None:
    1.32 +                pci_dev['opts'] = opts
    1.33  
    1.34 -                #append opts info
    1.35 -                opts = self.readBackend(devid, 'opts-%d' % i)
    1.36 -                if opts is not None:
    1.37 -                    dev_dict['opts'] = opts
    1.38 -
    1.39 -                pci_devs.append(dev_dict)
    1.40 +            pci_devs.append(pci_dev)
    1.41  
    1.42          result['devs'] = pci_devs
    1.43          result['uuid'] = self.readBackend(devid, 'uuid')