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>
This commit is contained in:
Ian Campbell committed 2011-10-18 13:36:43 +01:00
1 parent 5d834c79a4
commit 6dc92e085b
8 files changed
+165 -106

No files matched your search

+14 -5
View File
@@ -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;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.