提交 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: ...@@ -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) ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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"));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册