libvirt: Switch the default video model from 'cirrus' to 'virtio'

The current Nova default video device model of 'cirrus' was chosen by
commit 2c7dca4ede (Configuration element for describing video drivers,
2013-11-25).  While it has worked fine-enough for all these years,
Cirrus devices is is "considered harmful"[1] by QEMU graphics
maintainers since 2014.

The current recommended video device model for both UEFI and BIOS guests
is 'virtio'[1].  'virtio' is a sensible default whether or not the guest
has a native kernel (called "virtio-gpu" in Linux) driver -- i.e. if the
guest has the VirtIO GPU driver, then it'll be used; otherwise, the
'virtio' model falls back to VGA compatibiliy mode.

To quote the documentation[2] from a QEMU graphics maintainer:

    This ['virtio' in libvirt or 'virtio-vga' in QEMU terms] is a
    modern, virtio-based display device designed for virtual machines.
    It comes with VGA compatibility mode. You need a guest driver to
    make full use of this device. If your guest OS has no driver it
    should still show a working display thanks to the VGA compatibility
    mode, but the device will not provide any advantages over standard
    VGA then.  [...] This is the place where most development happens,
    support for new, cool features will most likely be added to this
    device.

[1] "qemu: using cirrus considered harmful"
    https://www.kraxel.org/blog/2014/10/qemu-using-cirrus-considered-harmful/

[2] https://www.kraxel.org/blog/2019/09/display-devices-in-qemu/#virtio-vga

Implements: blueprint virtio-as-default-display-device

Change-Id: I4c999bb4120768af40093ddb1e6004ee33c9698f
Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
This commit is contained in:
Kashyap Chamarthy 2021-06-22 13:20:57 +02:00
parent 5979c64846
commit cc59698d69
3 changed files with 19 additions and 1 deletions

View File

@ -2055,7 +2055,7 @@ class LibvirtConfigGuestVideo(LibvirtConfigGuestDevice):
super(LibvirtConfigGuestVideo, self).__init__(root_name="video",
**kwargs)
self.type = 'cirrus'
self.type = 'virtio'
self.vram = None
self.heads = None
self.driver_iommu = False

View File

@ -5920,6 +5920,15 @@ class LibvirtDriver(driver.ComputeDriver):
guestarch = libvirt_utils.get_arch(image_meta)
if CONF.libvirt.virt_type == 'parallels':
video.type = 'vga'
# NOTE(kchamart): 'virtio' is a sensible default whether or not
# the guest has the native kernel driver (called "virtio-gpu" in
# Linux) -- i.e. if the guest has the VirtIO GPU driver, it'll
# be used; otherwise, the 'virtio' model will gracefully
# fallback to VGA compatibiliy mode.
elif (guestarch in (fields.Architecture.I686,
fields.Architecture.X86_64) and not
CONF.spice.enabled):
video.type = 'virtio'
elif guestarch in (fields.Architecture.PPC,
fields.Architecture.PPC64,
fields.Architecture.PPC64LE):

View File

@ -0,0 +1,9 @@
---
features:
- |
From this release, Nova instances will get ``virtio`` as the default
display device (instead of ``cirrus``, which has many limitations).
If your guest has a native kernel (called "virtio-gpu" in Linux;
available since Linux 4.4 and above) driver, then it'll be used;
otherwise, the 'virtio' model will gracefully fallback to VGA
compatibiliy mode, which is still better than ``cirrus``.