]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Unify generation of command line for virtio devices
authorAndrea Bolognani <abologna@redhat.com>
Wed, 5 Sep 2018 16:24:55 +0000 (18:24 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 6 Sep 2018 14:30:34 +0000 (16:30 +0200)
commit04eb7479fc0d9196e07f7db227deb3a8003e8964
tree524daac4d323a07271e07edf909f7897485e923d
parent709f57c25be8fc519501cd4e650ecda4dd307dd8
qemu: Unify generation of command line for virtio devices

A virtio device such as

  <controller type='scsi' model='virtio-scsi'/>

will be translated to one of four different QEMU devices
based on the address type. This behavior is the same for
all virtio devices, but unfortunately we have separate
ad-hoc code dealing with each and every one of them: not
only this is pointless duplication, but it turns out
that most of that code is not robust against new address
types being introduced and some of it is outright buggy.

Introduce a new function, qemuBuildVirtioDevStr(), which
deals with the issue in a generic fashion, and rewrite
all existing code to use it.

This fixes a bunch of issues such as virtio-serial-pci
being used with virtio-mmio addresses and virtio-gpu
not being usable at all with virtio-mmio addresses.

It also introduces a couple of minor regressions,
namely no longer erroring out when attempting to
use virtio-balloon and virtio-input devices with
virtio-s390 addresses; that said, virtio-s390 has
been superseded by virtio-ccw such a long time ago
that recent QEMU releases have dropped support for
the former entirely, so re-implementing such
device-specific validation is not worth it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_command.c