aboutsummaryrefslogtreecommitdiffstats
path: root/tools/python
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2011-10-18 13:36:43 +0100
committerIan Campbell <ian.campbell@citrix.com>2011-10-18 13:36:43 +0100
commit6dc92e085b34e9502e42a53fd6969c9af483a307 (patch)
tree0cdaec0f47a59c200b1f9b9389876ab1ac1a5a81 /tools/python
parent5d834c79a4c5bbd3c1e96af5305922560044d383 (diff)
downloadxen-6dc92e085b34e9502e42a53fd6969c9af483a307.tar.gz
xen-6dc92e085b34e9502e42a53fd6969c9af483a307.tar.bz2
xen-6dc92e085b34e9502e42a53fd6969c9af483a307.zip
libxl: convert PCI device handling to device API
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/python')
-rw-r--r--tools/python/xen/lowlevel/xl/xl.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/tools/python/xen/lowlevel/xl/xl.c b/tools/python/xen/lowlevel/xl/xl.c
index f8a365d09d..005acd699d 100644
--- a/tools/python/xen/lowlevel/xl/xl.c
+++ b/tools/python/xen/lowlevel/xl/xl.c
@@ -521,9 +521,16 @@ static PyObject *pyxl_pci_del(XlObject *self, PyObject *args)
return NULL;
}
pci = (Py_device_pci *)obj;
- if ( libxl_device_pci_remove(self->ctx, domid, &pci->obj, force) ) {
- PyErr_SetString(xl_error_obj, "cannot remove pci device");
- return NULL;
+ if ( force ) {
+ if ( libxl_device_pci_destroy(self->ctx, domid, &pci->obj) ) {
+ PyErr_SetString(xl_error_obj, "cannot remove pci device");
+ return NULL;
+ }
+ } else {
+ if ( libxl_device_pci_remove(self->ctx, domid, &pci->obj) ) {
+ PyErr_SetString(xl_error_obj, "cannot remove pci device");
+ return NULL;
+ }
}
Py_INCREF(Py_None);
return Py_None;
@@ -558,7 +565,8 @@ static PyObject *pyxl_pci_list_assignable(XlObject *self, PyObject *args)
PyObject *list;
int nr_dev, i;
- if ( libxl_device_pci_list_assignable(self->ctx, &dev, &nr_dev) ) {
+ dev = libxl_device_pci_list_assignable(self->ctx, &nr_dev);
+ if ( dev == NULL ) {
PyErr_SetString(xl_error_obj, "Cannot list assignable devices");
return NULL;
}
@@ -594,7 +602,8 @@ static PyObject *pyxl_pci_list(XlObject *self, PyObject *args)
if ( !PyArg_ParseTuple(args, "i", &domid) )
return NULL;
- if ( libxl_device_pci_list_assigned(self->ctx, &dev, domid, &nr_dev) ) {
+ dev = libxl_device_pci_list(self->ctx, domid, &nr_dev);
+ if ( dev == NULL ) {
PyErr_SetString(xl_error_obj, "Cannot list assignable devices");
return NULL;
}