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

[Xen-changelog] [xen-unstable] xm: pass-through: sort the output of xm pci-list



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1244108624 -3600
# Node ID 6c24ffb01d6b6cda926032eacb55471b7eb449dd
# Parent  691087b8d4ac15f4e6d2a4e3dfce6feea596bdd9
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.

Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
---
 tools/python/xen/util/pci.py |    4 ++++
 tools/python/xen/xm/main.py  |    3 +++
 2 files changed, 7 insertions(+)

diff -r 691087b8d4ac -r 6c24ffb01d6b tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py      Thu Jun 04 10:43:20 2009 +0100
+++ b/tools/python/xen/util/pci.py      Thu Jun 04 10:43:44 2009 +0100
@@ -113,6 +113,10 @@ PAGE_MASK=~(PAGE_SIZE - 1)
 # Definitions from Linux: include/linux/pci.h
 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))
diff -r 691087b8d4ac -r 6c24ffb01d6b tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Thu Jun 04 10:43:20 2009 +0100
+++ b/tools/python/xen/xm/main.py       Thu Jun 04 10:43:44 2009 +0100
@@ -2204,6 +2204,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:

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