From cc59698d6903b0ed3778826d6704758294abbd69 Mon Sep 17 00:00:00 2001 From: Kashyap Chamarthy Date: Tue, 22 Jun 2021 13:20:57 +0200 Subject: [PATCH] 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 --- nova/virt/libvirt/config.py | 2 +- nova/virt/libvirt/driver.py | 9 +++++++++ ...irtio-as-default-display-device-5341d3d5180036e2.yaml | 9 +++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/virtio-as-default-display-device-5341d3d5180036e2.yaml diff --git a/nova/virt/libvirt/config.py b/nova/virt/libvirt/config.py index f9475776b3..229bd9d5d3 100644 --- a/nova/virt/libvirt/config.py +++ b/nova/virt/libvirt/config.py @@ -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 diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index fb819fa2b6..3478c68c80 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -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): diff --git a/releasenotes/notes/virtio-as-default-display-device-5341d3d5180036e2.yaml b/releasenotes/notes/virtio-as-default-display-device-5341d3d5180036e2.yaml new file mode 100644 index 0000000000..d27efce1fc --- /dev/null +++ b/releasenotes/notes/virtio-as-default-display-device-5341d3d5180036e2.yaml @@ -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``.