xen-devel
[Xen-devel] [patch 5/9] xm, xend: xen-api: DPCI.get_hotplug_slot() retur
xm uses the following code to read pci information using Xen API:
ppci_ref = server.xenapi.DPCI.get_PPCI(dpci_ref)
ppci_record = server.xenapi.PPCI.get_record(ppci_ref)
dev = {
"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.
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/xend/XendDPCI.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xend/XendDPCI.py 2009-06-03
15:03:10.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xend/XendDPCI.py 2009-06-03
15:04:10.000000000 +1000
@@ -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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] [patch 0/9] Xen API for pass-through, Simon Horman
- [Xen-devel] [patch 1/9] xend: pass-through: report attach errors from device model, Simon Horman
- [Xen-devel] [patch 2/9] xm: xen-api: Install create.dtd in SHAREDIR, Simon Horman
- [Xen-devel] [patch 3/9] xm: xen-api, pass-through: Dont pass empty opts, Simon Horman
- [Xen-devel] [patch 4/9] xend: pass-through: prefix vslot with 0x in device configration, Simon Horman
- [Xen-devel] [patch 5/9] xm, xend: xen-api: DPCI.get_hotplug_slot() returns a decimal,
Simon Horman <=
- [Xen-devel] [patch 6/9] xend: xen-api, pass-through: Add create_dpci_from_sxp(), Simon Horman
- [Xen-devel] [patch 7/9] xm: xen-api, pass-through: create: Use vslot for hotplug_slot, Simon Horman
- [Xen-devel] [patch 8/9] xend: pass-through: Use AUTO_PHP_SLOT as unknown vslot, Simon Horman
- [Xen-devel] [patch 9/9] xm: pass-through: sort the output of xm pci-list, Simon Horman
|
|
|