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-changelog

[Xen-changelog] [xen-unstable] xm, xend: xen-api: DPCI.get_hotplug_slot(

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xm, xend: xen-api: DPCI.get_hotplug_slot() returns a decimal
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 04 Jun 2009 10:25:39 -0700
Delivery-date: Thu, 04 Jun 2009 10:28:07 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1244108424 -3600
# Node ID 728eb34bbfcc1520255e71eeadd6dd26fc79ecad
# Parent  19fc31fe2e31279a4ab6faf69e37f17f5259d3c1
xm, xend: xen-api: DPCI.get_hotplug_slot() returns a decimal

xm uses the following code to read pci information using Xen API:

    ppci_ref =3D server.xenapi.DPCI.get_PPCI(dpci_ref)
    ppci_record =3D server.xenapi.PPCI.get_record(ppci_ref)
    dev =3D {
        "domain":   int(ppci_record["domain"]),
        "bus":      int(ppci_record["bus"]),
        "slot":     int(ppci_record["slot"]),
        "func":     int(ppci_record["func"]),
        "vslot":    int(server.xenapi.DPCI.get_hotplug_slot(dpci_ref))
    }

As the domain, bus, slot and func values are returned as string
representations of decimal, it makes sense for get_hotplug_slot() to
also return string representations of decimal.

As it is, the int() conversion will break cause xm to fail with
an error if the vslot is in the range 0xa-0xf or 0x1a-0x1f.

$ xm pci-list debian
Error: Invalid argument.

And the int() conversion will return the wrong value if
the vslot is in the range 0x10-0x19.

This patch also alters XendDPCI to store hotplug_vslot as an integer
rather than a string. This is consitent with the way other
values are stored inside XendDPCI.

get_hotplug_slot() returning a string is not consistent
with other calls inside XendDPCI, which return integers.

Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDPCI.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -r 19fc31fe2e31 -r 728eb34bbfcc tools/python/xen/xend/XendDPCI.py
--- a/tools/python/xen/xend/XendDPCI.py Thu Jun 04 10:39:32 2009 +0100
+++ b/tools/python/xen/xend/XendDPCI.py Thu Jun 04 10:40:24 2009 +0100
@@ -119,7 +119,7 @@ class XendDPCI(XendBase):
 
         self.VM = record['VM']
         self.PPCI = record['PPCI']
-        self.hotplug_slot = record['hotplug_slot']
+        self.hotplug_slot = int(record['hotplug_slot'], 16)
         if 'options' in record.keys():
             self.options = record['options']
 
@@ -153,7 +153,7 @@ class XendDPCI(XendBase):
         return self.PPCI
 
     def get_hotplug_slot(self):
-        return self.hotplug_slot
+        return "%d" % self.hotplug_slot
 
     def get_options(self):
         return self.options

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xm, xend: xen-api: DPCI.get_hotplug_slot() returns a decimal, Xen patchbot-unstable <=