[libvirt] [PATCH] qemu: Add device id for mediated devices on qemu command line

Erik Skultety eskultet at redhat.com
Mon Apr 3 14:12:17 UTC 2017


Like all devices, add the 'id' option for mdevs as well. Patch also
adjusts the test accordingly.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1438431

Signed-off-by: Erik Skultety <eskultet at redhat.com>
---
 src/qemu/qemu_command.c                                          | 3 ++-
 tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-precreated.args | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5cf383aaea..445c696d6e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5231,7 +5231,8 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *def,
     char *ret = NULL;
 
     virBufferAddLit(&buf, "vfio-pci");
-    virBufferAsprintf(&buf, ",sysfsdev=%s",
+    virBufferAsprintf(&buf, ",id=%s,sysfsdev=%s",
+                      dev->info->alias,
                       virMediatedDeviceGetSysfsPath(mdevsrc->uuidstr));
 
     if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0)
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-precreated.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-precreated.args
index fdefeb6104..76e77707bf 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-precreated.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-precreated.args
@@ -20,6 +20,6 @@ QEMU_AUDIO_DRV=none \
 -usb \
 -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--device vfio-pci,\
+-device vfio-pci,id=hostdev0,\
 sysfsdev=/sys/bus/mdev/devices/53764d0e-85a0-42b4-af5c-2046b460b1dc,bus=pci.0,\
 addr=0x3
-- 
2.12.2




More information about the libvir-list mailing list