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 9/9] xm: pass-through: sort the output of xm pci-list

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [patch 9/9] xm: pass-through: sort the output of xm pci-list
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Thu, 04 Jun 2009 13:21:24 +1000
Cc: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>, Dexuan Cui <dexuan.cui@xxxxxxxxx>
Delivery-date: Wed, 03 Jun 2009 20:34:47 -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: <20090604032115.934982694@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: quilt/0.46-1
Other than being arguably more human readable,
this patch reconciles the output differences between
using Xen API and xmlrpc to manipulate domains.

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/util/pci.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/util/pci.py   2009-06-04 
09:34:36.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/util/pci.py        2009-06-04 
09:35:10.000000000 +1000
@@ -114,6 +114,10 @@ PAGE_MASK=~(PAGE_SIZE - 1)
 def PCI_DEVFN(slot, func):
     return ((((slot) & 0x1f) << 3) | ((func) & 0x07))
 
+def PCI_BDF(domain, bus, slot, func):
+    return (((domain & 0xffff) << 16) | ((bus & 0xff) << 8) |
+            PCI_DEVFN(slot, func))
+
 def serialise_pci_opts(opts):
     return reduce(lambda x, y: x+','+y, map(lambda (x, y): x+'='+y, opts))
 
Index: xen-unstable.hg/tools/python/xen/xm/main.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xm/main.py    2009-06-04 
09:33:27.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xm/main.py 2009-06-04 11:03:13.000000000 
+1000
@@ -2205,6 +2205,9 @@ def xm_pci_list(args):
     if len(devs) == 0:
         return
 
+    devs.sort(None, lambda x: x['vslot'] << 32 | PCI_BDF(x['domain'], x['bus'],
+                                                         x['slot'], x['func']))
+
     has_vslot = False
     for x in devs:
         if x['vslot'] == AUTO_PHP_SLOT:

-- 

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