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

[Xen-changelog] [xen-unstable] xend: pass-through: Use common parsing code in getDeviceConfiguration()



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1245220743 -3600
# Node ID 902df7680e2e311ba281a0ed6bf999ab525630a9
# Parent  85fdfb7da88cd22089fcf3f3218b1bc01a02dcc5
xend: pass-through: Use common parsing code in getDeviceConfiguration()

Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
---
 tools/python/xen/xend/server/pciif.py |   37 +++++++++++-----------------------
 1 files changed, 12 insertions(+), 25 deletions(-)

diff -r 85fdfb7da88c -r 902df7680e2e tools/python/xen/xend/server/pciif.py
--- a/tools/python/xen/xend/server/pciif.py     Wed Jun 17 07:38:42 2009 +0100
+++ b/tools/python/xen/xend/server/pciif.py     Wed Jun 17 07:39:03 2009 +0100
@@ -170,31 +170,18 @@ class PciController(DevController):
         pci_devs = []
 
         for i in range(int(num_devs)):
-            dev_config = self.readBackend(devid, 'dev-%d' % i)
-
-            pci_match = re.match(r"((?P<domain>[0-9a-fA-F]{1,4})[:,])?" +
-                                 r"(?P<bus>[0-9a-fA-F]{1,2})[:,]" + 
-                                 r"(?P<slot>[0-9a-fA-F]{1,2})[.,]" + 
-                                 r"(?P<func>[0-7]{1,2})$", dev_config)
-            
-            if pci_match!=None:
-                pci_dev_info = pci_match.groupdict()
-                dev_dict = {'domain': '0x%(domain)s' % pci_dev_info,
-                                 'bus': '0x%(bus)s' % pci_dev_info,
-                                 'slot': '0x%(slot)s' % pci_dev_info,
-                                 'func': '0x%(func)s' % pci_dev_info}
-
-                # Per device uuid info
-                dev_dict['uuid'] = self.readBackend(devid, 'uuid-%d' % i)
-                dev_dict['vslot'] = '0x%s' % \
-                                    self.readBackend(devid, 'vslot-%d' % i)
-
-                #append opts info
-                opts = self.readBackend(devid, 'opts-%d' % i)
-                if opts is not None:
-                    dev_dict['opts'] = opts
-
-                pci_devs.append(dev_dict)
+            pci_dev = parse_pci_name(self.readBackend(devid, 'dev-%d' % i))
+
+            # Per device uuid info
+            pci_dev['uuid'] = self.readBackend(devid, 'uuid-%d' % i)
+            pci_dev['vslot'] = '0x%s' % self.readBackend(devid, 'vslot-%d' % i)
+
+            #append opts info
+            opts = self.readBackend(devid, 'opts-%d' % i)
+            if opts is not None:
+                pci_dev['opts'] = opts
+
+            pci_devs.append(pci_dev)
 
         result['devs'] = pci_devs
         result['uuid'] = self.readBackend(devid, 'uuid')

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