mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemuGetPciHostDeviceList take hostdev list directly
- src/qemu/qemu_driver.c: Update qemuGetPciHostDeviceList to take a hostdev list and count directly, rather than getting this indirectly from domain definition. This will allow reuse for the attach-device case.
This commit is contained in:
parent
d3864c3782
commit
8bd00c0edf
@ -3000,7 +3000,7 @@ cleanup:
|
|||||||
|
|
||||||
|
|
||||||
static pciDeviceList *
|
static pciDeviceList *
|
||||||
qemuGetPciHostDeviceList(virDomainDefPtr def)
|
qemuGetPciHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
|
||||||
{
|
{
|
||||||
pciDeviceList *list;
|
pciDeviceList *list;
|
||||||
int i;
|
int i;
|
||||||
@ -3008,8 +3008,8 @@ qemuGetPciHostDeviceList(virDomainDefPtr def)
|
|||||||
if (!(list = pciDeviceListNew()))
|
if (!(list = pciDeviceListNew()))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0 ; i < def->nhostdevs ; i++) {
|
for (i = 0 ; i < nhostdevs ; i++) {
|
||||||
virDomainHostdevDefPtr hostdev = def->hostdevs[i];
|
virDomainHostdevDefPtr hostdev = hostdevs[i];
|
||||||
pciDevice *dev;
|
pciDevice *dev;
|
||||||
|
|
||||||
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
|
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
|
||||||
@ -3049,7 +3049,7 @@ qemuUpdateActivePciHostdevs(struct qemud_driver *driver,
|
|||||||
if (!def->nhostdevs)
|
if (!def->nhostdevs)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!(pcidevs = qemuGetPciHostDeviceList(def)))
|
if (!(pcidevs = qemuGetPciHostDeviceList(def->hostdevs, def->nhostdevs)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
|
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
|
||||||
@ -3077,7 +3077,7 @@ qemuPrepareHostPCIDevices(struct qemud_driver *driver,
|
|||||||
int i;
|
int i;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (!(pcidevs = qemuGetPciHostDeviceList(def)))
|
if (!(pcidevs = qemuGetPciHostDeviceList(def->hostdevs, def->nhostdevs)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* We have to use 3 loops here. *All* devices must
|
/* We have to use 3 loops here. *All* devices must
|
||||||
@ -3229,7 +3229,7 @@ qemuDomainReAttachHostDevices(struct qemud_driver *driver,
|
|||||||
if (!def->nhostdevs)
|
if (!def->nhostdevs)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(pcidevs = qemuGetPciHostDeviceList(def))) {
|
if (!(pcidevs = qemuGetPciHostDeviceList(def->hostdevs, def->nhostdevs))) {
|
||||||
virErrorPtr err = virGetLastError();
|
virErrorPtr err = virGetLastError();
|
||||||
VIR_ERROR(_("Failed to allocate pciDeviceList: %s"),
|
VIR_ERROR(_("Failed to allocate pciDeviceList: %s"),
|
||||||
err ? err->message : _("unknown error"));
|
err ? err->message : _("unknown error"));
|
||||||
|
Loading…
Reference in New Issue
Block a user