Re: [PATCH 4/6] qemu: Wire up disk model=virtio-{non-}transitional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux