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

[Xen-devel] [patch 9/9] xm: pass-through: sort the output of xm pci-list



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.