[libvirt] [PATCH] Don't parse/format vram attribute for cirrus video

Jonathon Jongsma jjongsma at redhat.com
Thu Jun 20 19:51:12 UTC 2019


Since the cirrus vga memory size isn't configurable, we can ignore any
'vram' attribute when parsing a domain definition. However, when no
value is specified, it ends up getting set to a default value of 16MB.
This 16MB value is not used anywhere (for example, it is not passed as
an argument to qemu), but is displayed in the XML definition. So by
changing this default value to 0, it will also be omitted from the XML
definition of the domain.

Fixes: rhbz#1447831

Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
---
This is an attempt to apply the fix suggested by Gerd at
https://bugzilla.redhat.com/show_bug.cgi?id=1447831#c2. I'm not
totally confident that this is the right approach, since I'm
relatively new to the code. Another approach might be to simply close
the bug as NOTABUG since it doesn't seem that having this unused
attribute in the domain definition has any significant drawbacks.

 src/conf/domain_conf.c | 2 +-
 src/qemu/qemu_domain.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c69d382d70..d06e094b11 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15154,7 +15154,6 @@ virDomainVideoDefaultRAM(const virDomainDef *def,
 {
     switch (type) {
     case VIR_DOMAIN_VIDEO_TYPE_VGA:
-    case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
     case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
         if (def->virtType == VIR_DOMAIN_VIRT_VBOX)
             return 8 * 1024;
@@ -15172,6 +15171,7 @@ virDomainVideoDefaultRAM(const virDomainDef *def,
         /* QEMU use 64M as the minimal video memory for qxl device */
         return 64 * 1024;
 
+    case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
     case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
     case VIR_DOMAIN_VIDEO_TYPE_VBOX:
     case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index e5c6ef3fda..7f0baf57ac 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6835,6 +6835,9 @@ qemuDomainDeviceVideoDefPostParse(virDomainVideoDefPtr video,
     if (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL &&
         !video->vgamem) {
         video->vgamem = QEMU_QXL_VGAMEM_DEFAULT;
+    } else if (video->type == VIR_DOMAIN_VIDEO_TYPE_CIRRUS) {
+        /* cirrus vram is not configurable. Ignore it */
+        video->vram = 0;
     }
 
     return 0;
-- 
2.20.1




More information about the libvir-list mailing list