]> git.proxmox.com Git - qemu-server.git/commit
fix #2510: hostpci: always check if device exists
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 9 Dec 2019 09:10:04 +0000 (10:10 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 9 Dec 2019 10:30:14 +0000 (11:30 +0100)
commit844b55fb8968f05efb1520fdf90b8b03ca485458
tree9445f9c13e7d25736a51b5d0bb35ba4f1f7a1a94
parent0360faadc70332ea060d67fe02e515ed078049f4
fix #2510: hostpci: always check if device exists

if the user set a device as hostpci with the 'shorthand' syntax:

hostpciX: 00:12

we ignored it on starting and showcmd and continued.
Since the user explicitly wanted to passthrough a device, we now check
if there is actually a device with that id

for explicitly configured devices (00:12.1), we did not check if it exists,
but the kvm call failed with a non-obvious error message

now we always call 'lspci' from SysFSTools to check if it actually exists,
and fail if not. With this, we can drop the workaround for adding
'0000' if no domain was given, since lspci does it already for us

this fixes #2510, an issue with using mediated devices where the users did not have
the domain in the config, since we forgot to add the default domain there

the only issue with this patch is that it changes the behaviour of
'showcmd' slightly, as in now, we die if the device was explicitly
given, but did not exists (we showed the commandline, now we fail)

this also slightly changes the commandline for qemu (adding always
the domain), which is not a problem since we cannot live migrate
or snapshot such vms, but we have to adapt the tests

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/QemuServer.pm
test/cfg2cmd/i440fx-win10-hostpci.conf.cmd
test/cfg2cmd/q35-linux-hostpci.conf.cmd
test/cfg2cmd/q35-win10-hostpci.conf.cmd