[PATCH] libxl: fix default vram setting for implicit video device

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

 



Commit 6879be48 moved adding of an implicit video device after XML
parsing. As a result, libxlDomainDeviceDefPostParse() is no longer
called to set the default vram when adding an implicit device.
Commit 6879be48 assumes virDomainVideoDefaultRAM() will set the
default vram, but it returns 0 if the domain virtType is
VIR_DOMAIN_VIRT_XEN. Attempting to start an HVM domain with vram=0
results in

error: unsupported configuration: videoram must be at least 4MB for CIRRUS

The default vram setting for Xen HVM domains depends on the device
model used (qemu-xen vs qemu-traditional), hence setting the
default is deferred to libxlDomainDeviceDefPostParse().

This patch addresses the problem during creation of the video
device. If vram is 0, it is assumed unset and the default
(depending on qemu-xen vs qemu-traditional) is applied.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1334557
Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
---
 src/libxl/libxl_conf.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index d927b37..1973ded 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1916,6 +1916,40 @@ libxlMakePCIList(virDomainDefPtr def, libxl_domain_config *d_config)
     return -1;
 }
 
+static unsigned int
+libxlVideoDefaultRAM(const virDomainVideoType type, int dm_type)
+{
+    unsigned int ret = 0;
+
+    switch (type) {
+    case VIR_DOMAIN_VIDEO_TYPE_VGA:
+    case VIR_DOMAIN_VIDEO_TYPE_XEN:
+        if (dm_type == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN)
+            ret = 16 * 1024;
+        else
+            ret = 8 * 1024;
+        break;
+
+    case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
+        if (dm_type == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN)
+            ret = 8 * 1024;
+        else
+            ret = 4 * 1024;
+        break;
+
+#ifdef LIBXL_HAVE_QXL
+    case VIR_DOMAIN_VIDEO_TYPE_QXL:
+        ret = 128 * 1024;
+        break;
+#endif
+
+    default:
+        break;
+    }
+
+    return ret;
+}
+
 static int
 libxlMakeVideo(virDomainDefPtr def, libxl_domain_config *d_config)
 
@@ -1931,6 +1965,10 @@ libxlMakeVideo(virDomainDefPtr def, libxl_domain_config *d_config)
      * on the first graphics device (display).
      */
     if (def->nvideos) {
+        if (def->videos[0]->vram == 0)
+            def->videos[0]->vram = libxlVideoDefaultRAM(def->videos[0]->type,
+                                                        dm_type);
+
         switch (def->videos[0]->type) {
         case VIR_DOMAIN_VIDEO_TYPE_VGA:
         case VIR_DOMAIN_VIDEO_TYPE_XEN:
-- 
2.1.4

--
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]