[libvirt] [PATCH 4/6] qemu: Wire up disk model=virtio-{non-}transitional
Daniel P. Berrangé
berrange at redhat.com
Tue Jan 15 16:56:14 UTC 2019
On Sun, Jan 13, 2019 at 06:12:06PM -0500, Cole Robinson wrote:
> Add new <disk> model values for virtio transitional devices. When
> combined with bus='virtio':
>
> * "virtio-transitional" maps to qemu "virtio-blk-pci-transitional"
> * "virtio-non-transitional" maps to qemu "virtio-blk-pci-non-transitional"
>
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
> src/qemu/qemu_command.c | 31 ++++++++++++++++++-
> src/qemu/qemu_domain_address.c | 2 ++
> ...virtio-non-transitional.x86_64-latest.args | 7 +++--
> .../virtio-transitional.x86_64-latest.args | 4 +--
> .../virtio-non-transitional.xml | 10 ++++--
> 5 files changed, 45 insertions(+), 9 deletions(-)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 822d5f8669..ca6abea227 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -443,6 +443,33 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
> return 0;
> }
>
> +static int
> +qemuBuildVirtioTransitional(virBufferPtr buf,
> + const char *baseName,
> + virDomainDeviceAddressType type,
> + bool transitional,
> + bool nontransitional)
> +{
> + if (qemuBuildVirtioDevStr(buf, baseName, type) < 0)
> + return -1;
> +
> + if (type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
> + (transitional || nontransitional)) {
> + virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> + _("virtio transitional models are not supported "
> + "for address type=%s"),
> + virDomainDeviceAddressTypeToString(type));
> + return -1;
> + }
> +
> + if (transitional) {
> + virBufferAddLit(buf, "-transitional");
> + } else if (nontransitional) {
> + virBufferAddLit(buf, "-non-transitional");
> + }
> + return 0;
So this only works on QEMU >= 4.0.0 - earlier versions will
fail to start.
We can, however, make it work correctly with old QEMU.
A transitional device is 100% identical to the existing device
types, so we can simply not add the "-transitional" suffix for
old QEMU. The only difference is the way libvirt does PCI bus
placement of the transitional device - we'd never use PCIe.
A non-transitional device is identical to the existing device
types, but with disable-legacy=true set.
QEMU guarantees this compatibility of the different devices,
but only for machine types < pc-i440fx-4.0.0 / pc-q35-4.0.0.
So we should none the less make sure we use the modern device
names for any QEMU which genuinely supports them.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
More information about the libvir-list
mailing list