ia64/xen-unstable

changeset 19723:6c24ffb01d6b

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@verge.net.au>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 04 10:43:44 2009 +0100 (2009-06-04)
parents 691087b8d4ac
children 2c1d94eb996f
files tools/python/xen/util/pci.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/util/pci.py	Thu Jun 04 10:43:20 2009 +0100
     1.2 +++ b/tools/python/xen/util/pci.py	Thu Jun 04 10:43:44 2009 +0100
     1.3 @@ -114,6 +114,10 @@ PAGE_MASK=~(PAGE_SIZE - 1)
     1.4  def PCI_DEVFN(slot, func):
     1.5      return ((((slot) & 0x1f) << 3) | ((func) & 0x07))
     1.6  
     1.7 +def PCI_BDF(domain, bus, slot, func):
     1.8 +    return (((domain & 0xffff) << 16) | ((bus & 0xff) << 8) |
     1.9 +            PCI_DEVFN(slot, func))
    1.10 +
    1.11  def serialise_pci_opts(opts):
    1.12      return reduce(lambda x, y: x+','+y, map(lambda (x, y): x+'='+y, opts))
    1.13  
     2.1 --- a/tools/python/xen/xm/main.py	Thu Jun 04 10:43:20 2009 +0100
     2.2 +++ b/tools/python/xen/xm/main.py	Thu Jun 04 10:43:44 2009 +0100
     2.3 @@ -2205,6 +2205,9 @@ def xm_pci_list(args):
     2.4      if len(devs) == 0:
     2.5          return
     2.6  
     2.7 +    devs.sort(None, lambda x: x['vslot'] << 32 | PCI_BDF(x['domain'], x['bus'],
     2.8 +                                                         x['slot'], x['func']))
     2.9 +
    2.10      has_vslot = False
    2.11      for x in devs:
    2.12          if x['vslot'] == AUTO_PHP_SLOT: