render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
3e5111
From 23a4263e7611fa3f1e69f5bab7056a85e48d6b23 Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <23a4263e7611fa3f1e69f5bab7056a85e48d6b23@dist-git>
3e5111
From: Erik Skultety <eskultet@redhat.com>
3e5111
Date: Tue, 4 Apr 2017 08:54:51 +0200
3e5111
Subject: [PATCH] qemu: Add device id for mediated devices on qemu command line
3e5111
3e5111
Like all devices, add the 'id' option for mdevs as well. Patch also
3e5111
adjusts the test accordingly.
3e5111
3e5111
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1438431
3e5111
3e5111
(cherry picked from commit c3272e5e12e0bfd43b8101b73ae13d264c13337f)
3e5111
Signed-off-by: Erik Skultety <eskultet@redhat.com>
3e5111
---
3e5111
 src/qemu/qemu_command.c                                          | 3 ++-
3e5111
 tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-precreated.args | 2 +-
3e5111
 2 files changed, 3 insertions(+), 2 deletions(-)
3e5111
3e5111
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
3e5111
index 1a2984e56..59fedaaaf 100644
3e5111
--- a/src/qemu/qemu_command.c
3e5111
+++ b/src/qemu/qemu_command.c
3e5111
@@ -5231,7 +5231,8 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *def,
3e5111
     char *ret = NULL;
3e5111
 
3e5111
     virBufferAddLit(&buf, "vfio-pci");
3e5111
-    virBufferAsprintf(&buf, ",sysfsdev=%s",
3e5111
+    virBufferAsprintf(&buf, ",id=%s,sysfsdev=%s",
3e5111
+                      dev->info->alias,
3e5111
                       virMediatedDeviceGetSysfsPath(mdevsrc->uuidstr));
3e5111
 
3e5111
     if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0)
3e5111
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-precreated.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-precreated.args
3e5111
index fdefeb610..76e77707b 100644
3e5111
--- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-precreated.args
3e5111
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-precreated.args
3e5111
@@ -20,6 +20,6 @@ QEMU_AUDIO_DRV=none \
3e5111
 -usb \
3e5111
 -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
3e5111
 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
3e5111
--device vfio-pci,\
3e5111
+-device vfio-pci,id=hostdev0,\
3e5111
 sysfsdev=/sys/bus/mdev/devices/53764d0e-85a0-42b4-af5c-2046b460b1dc,bus=pci.0,\
3e5111
 addr=0x3
3e5111
-- 
3e5111
2.12.2
3e5111