WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [patch 7/8] xend: pass-through: Use common parsing code in g

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [patch 7/8] xend: pass-through: Use common parsing code in getDeviceConfiguration()
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Tue, 16 Jun 2009 23:00:56 +1000
Cc: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>, Dexuan Cui <dexuan.cui@xxxxxxxxx>
Delivery-date: Tue, 16 Jun 2009 06:18:26 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20090616130049.981995120@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: quilt/0.46-1
This will be re-used in subsequent patches.

Cc: Dexuan Cui <dexuan.cui@xxxxxxxxx>
Cc: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

Index: xen-unstable.hg/tools/python/xen/xend/server/pciif.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xend/server/pciif.py  2009-06-07 
21:58:38.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xend/server/pciif.py       2009-06-07 
22:12:13.000000000 +1000
@@ -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_dev = parse_pci_name(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
+            # 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(dev_dict)
+            pci_devs.append(pci_dev)
 
         result['devs'] = pci_devs
         result['uuid'] = self.readBackend(devid, 'uuid')

-- 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel