提交 8bd00c0e 编写于 作者: C Chris Wright 提交者: Daniel Veillard

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.
上级 d3864c37
......@@ -3000,7 +3000,7 @@ cleanup:
static pciDeviceList *
qemuGetPciHostDeviceList(virDomainDefPtr def)
qemuGetPciHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
{
pciDeviceList *list;
int i;
......@@ -3008,8 +3008,8 @@ qemuGetPciHostDeviceList(virDomainDefPtr def)
if (!(list = pciDeviceListNew()))
return NULL;
for (i = 0 ; i < def->nhostdevs ; i++) {
virDomainHostdevDefPtr hostdev = def->hostdevs[i];
for (i = 0 ; i < nhostdevs ; i++) {
virDomainHostdevDefPtr hostdev = hostdevs[i];
pciDevice *dev;
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
......@@ -3049,7 +3049,7 @@ qemuUpdateActivePciHostdevs(struct qemud_driver *driver,
if (!def->nhostdevs)
return 0;
if (!(pcidevs = qemuGetPciHostDeviceList(def)))
if (!(pcidevs = qemuGetPciHostDeviceList(def->hostdevs, def->nhostdevs)))
return -1;
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
......@@ -3077,7 +3077,7 @@ qemuPrepareHostPCIDevices(struct qemud_driver *driver,
int i;
int ret = -1;
if (!(pcidevs = qemuGetPciHostDeviceList(def)))
if (!(pcidevs = qemuGetPciHostDeviceList(def->hostdevs, def->nhostdevs)))
return -1;
/* We have to use 3 loops here. *All* devices must
......@@ -3229,7 +3229,7 @@ qemuDomainReAttachHostDevices(struct qemud_driver *driver,
if (!def->nhostdevs)
return;
if (!(pcidevs = qemuGetPciHostDeviceList(def))) {
if (!(pcidevs = qemuGetPciHostDeviceList(def->hostdevs, def->nhostdevs))) {
virErrorPtr err = virGetLastError();
VIR_ERROR(_("Failed to allocate pciDeviceList: %s"),
err ? err->message : _("unknown error"));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册