[libvirt] [PATCH 4/4] qemu-command: introduce new vgamem attribute for video devices

Pavel Hrdina phrdina at redhat.com
Mon Nov 3 13:01:50 UTC 2014


So far we hadn't any option to set video memory size for qemu video
devices. There were only vram (ram for QXL) attribute but it was valid
only for QXL video device, but it didn't set video memory only pci bar
memory.

To provide this feature to users qemu has dedicated device attribute
called 'vgamem_mb' to set the video memory size. We will export this
attribute as 'vgamem' and it will be in KiB (internally converted to MiB
to pass the value in correct format for QEMU). It's only supported by
those video devices: cirrus, qxl, vga and vmvga.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1076098

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 docs/formatdomain.html.in                          |  7 +++-
 docs/schemas/domaincommon.rng                      |  5 +++
 src/conf/domain_conf.c                             | 47 ++++++++++++++++++++++
 src/conf/domain_conf.h                             |  2 +
 src/libvirt_private.syms                           |  1 +
 src/qemu/qemu_command.c                            | 45 +++++++++++++++++++++
 ...qemuhotplug-console-compat-2+console-virtio.xml |  2 +-
 .../qemuxml2argv-console-compat-2.xml              |  2 +-
 .../qemuxml2argv-graphics-listen-network.xml       |  2 +-
 .../qemuxml2argv-graphics-sdl-fullscreen.xml       |  2 +-
 .../qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml |  2 +-
 .../qemuxml2argv-graphics-spice-compression.xml    |  4 +-
 .../qemuxml2argv-graphics-spice-qxl-vga.xml        |  4 +-
 .../qemuxml2argv-graphics-spice.xml                |  4 +-
 .../qemuxml2argv-graphics-vnc-policy.xml           |  2 +-
 .../qemuxml2argv-graphics-vnc-sasl.xml             |  2 +-
 .../qemuxml2argv-graphics-vnc-socket.xml           |  2 +-
 .../qemuxml2argv-graphics-vnc-tls.xml              |  2 +-
 .../qemuxml2argv-graphics-vnc-websocket.xml        |  2 +-
 .../qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml |  2 +-
 .../qemuxml2argv-net-bandwidth.xml                 |  2 +-
 tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml |  2 +-
 .../qemuxml2argv-pcihole64-q35.xml                 |  2 +-
 .../qemuxml2argvdata/qemuxml2argv-pseries-disk.xml |  2 +-
 .../qemuxml2argv-serial-spiceport.xml              |  2 +-
 .../qemuxml2argv-video-qxl-device-vgamem.args      |  6 +++
 .../qemuxml2argv-video-qxl-device-vgamem.xml       | 29 +++++++++++++
 .../qemuxml2argv-video-qxl-device.args             |  6 +++
 .../qemuxml2argv-video-qxl-device.xml              | 29 +++++++++++++
 .../qemuxml2argv-video-qxl-nodevice.args           |  5 +++
 .../qemuxml2argv-video-qxl-nodevice.xml            | 29 +++++++++++++
 .../qemuxml2argv-video-qxl-sec-device-vgamem.args  |  8 ++++
 .../qemuxml2argv-video-qxl-sec-device-vgamem.xml   | 32 +++++++++++++++
 .../qemuxml2argv-video-qxl-sec-device.args         |  7 ++++
 .../qemuxml2argv-video-qxl-sec-device.xml          | 32 +++++++++++++++
 .../qemuxml2argv-video-qxl-sec-nodevice.xml        | 32 +++++++++++++++
 .../qemuxml2argv-video-vga-device-vgamem.args      |  6 +++
 .../qemuxml2argv-video-vga-device-vgamem.xml       | 29 +++++++++++++
 .../qemuxml2argv-video-vga-device.args             |  6 +++
 .../qemuxml2argv-video-vga-device.xml              | 29 +++++++++++++
 .../qemuxml2argv-video-vga-nodevice.args           |  5 +++
 .../qemuxml2argv-video-vga-nodevice.xml            | 29 +++++++++++++
 tests/qemuxml2argvtest.c                           | 18 +++++++++
 .../qemuxml2xmlout-graphics-listen-network2.xml    |  2 +-
 .../qemuxml2xmlout-graphics-spice-timeout.xml      |  2 +-
 .../qemuxml2xmlout-pci-autoadd-addr.xml            |  2 +-
 .../qemuxml2xmlout-pci-autoadd-idx.xml             |  2 +-
 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml    |  2 +-
 ...emuxml2xmlout-seclabel-dynamic-none-relabel.xml |  2 +-
 49 files changed, 471 insertions(+), 29 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-nodevice.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.xml

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 24be21c..f8ae70b 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4605,7 +4605,7 @@ qemu-kvm -net nic,model=? /dev/null
   ...
   <devices>
     <video>
-      <model type='vga' vram='8192' heads='1'>
+      <model type='vga' vram='8192' vgamem='16384' heads='1'>
         <acceleration accel3d='yes' accel2d='yes'/>
       </model>
     </video>
@@ -4647,6 +4647,11 @@ qemu-kvm -net nic,model=? /dev/null
           type of "libxl", "parallels", "vbox", "vmx" and "xen".
         </p>
         <p>
+          To set video memory for QEMU/KVM video devices you can use
+          <code>vgamem</code> attribute. If you don't provide any value the
+          default "16MiB" will be used. (<span class="since">since 1.2.11</span>)
+        </p>
+        <p>
           The number of screen can be set using <code>heads</code>. This is
           supported only for guests type of "parallels", "kvm", "vbox" and "vmx".
         </p>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 20d81ae..db31d22 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2864,6 +2864,11 @@
             </attribute>
           </optional>
           <optional>
+            <attribute name="vgamem">
+              <ref name="unsignedInt"/>
+            </attribute>
+          </optional>
+          <optional>
             <attribute name="heads">
               <ref name="unsignedInt"/>
             </attribute>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 042364a..48656cb 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10029,6 +10029,20 @@ virDomainVideoDefaultRAM(const virDomainDef *def,
     }
 }
 
+unsigned int
+virDomainVideoDefaultVgamem(const virDomainVideoType type)
+{
+    switch (type) {
+    case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
+    case VIR_DOMAIN_VIDEO_TYPE_QXL:
+    case VIR_DOMAIN_VIDEO_TYPE_VGA:
+    case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
+        return 16 * 1024;
+
+    default:
+        return 0;
+    }
+}
 
 int
 virDomainVideoDefaultType(const virDomainDef *def)
@@ -10116,6 +10130,7 @@ virDomainVideoDefParseXML(xmlNodePtr node,
     char *vram = NULL;
     char *ram = NULL;
     char *primary = NULL;
+    char *vgamem = NULL;
 
     if (VIR_ALLOC(def) < 0)
         return NULL;
@@ -10128,6 +10143,7 @@ virDomainVideoDefParseXML(xmlNodePtr node,
                 type = virXMLPropString(cur, "type");
                 ram = virXMLPropString(cur, "ram");
                 vram = virXMLPropString(cur, "vram");
+                vgamem = virXMLPropString(cur, "vgamem");
                 heads = virXMLPropString(cur, "heads");
 
                 if ((primary = virXMLPropString(cur, "primary")) != NULL) {
@@ -10192,6 +10208,25 @@ virDomainVideoDefParseXML(xmlNodePtr node,
             def->vram = virDomainVideoDefaultRAM(dom, def->type);
     }
 
+    if (vgamem) {
+        if (def->type != VIR_DOMAIN_VIDEO_TYPE_CIRRUS &&
+            def->type != VIR_DOMAIN_VIDEO_TYPE_QXL &&
+            def->type != VIR_DOMAIN_VIDEO_TYPE_VGA &&
+            def->type != VIR_DOMAIN_VIDEO_TYPE_VMVGA) {
+            virReportError(VIR_ERR_XML_ERROR,
+                           _("vgamem attribute is not supported by '%s' video device"),
+                           virDomainVideoTypeToString(def->type));
+            goto error;
+        }
+        if (virStrToLong_ui(vgamem, NULL, 10, &def->vgamem) < 0) {
+            virReportError(VIR_ERR_XML_ERROR,
+                           _("cannot parse video vgamem '%s'"), vgamem);
+            goto error;
+        }
+    } else {
+        def->vgamem = virDomainVideoDefaultVgamem(def->type);
+    }
+
     if (heads) {
         if (virStrToLong_ui(heads, NULL, 10, &def->heads) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -10208,6 +10243,7 @@ virDomainVideoDefParseXML(xmlNodePtr node,
     VIR_FREE(type);
     VIR_FREE(ram);
     VIR_FREE(vram);
+    VIR_FREE(vgamem);
     VIR_FREE(heads);
 
     return def;
@@ -10217,6 +10253,7 @@ virDomainVideoDefParseXML(xmlNodePtr node,
     VIR_FREE(type);
     VIR_FREE(ram);
     VIR_FREE(vram);
+    VIR_FREE(vgamem);
     VIR_FREE(heads);
     return NULL;
 }
@@ -13636,6 +13673,7 @@ virDomainDefParseXML(xmlDocPtr xml,
             goto error;
         }
         video->vram = virDomainVideoDefaultRAM(def, video->type);
+        video->vgamem = virDomainVideoDefaultVgamem(video->type);
         video->heads = 1;
         if (VIR_ALLOC_N(def->videos, 1) < 0) {
             virDomainVideoDefFree(video);
@@ -14560,6 +14598,13 @@ virDomainVideoDefCheckABIStability(virDomainVideoDefPtr src,
         return false;
     }
 
+    if (src->vgamem != dst->vgamem) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Target video card vgamem %u does not match source %u"),
+                       dst->vgamem, src->vgamem);
+        return false;
+    }
+
     if (src->heads != dst->heads) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target video card heads %u does not match source %u"),
@@ -17887,6 +17932,8 @@ virDomainVideoDefFormat(virBufferPtr buf,
         virBufferAsprintf(buf, " ram='%u'", def->ram);
     if (def->vram)
         virBufferAsprintf(buf, " vram='%u'", def->vram);
+    if (def->vgamem)
+        virBufferAsprintf(buf, " vgamem='%u'", def->vgamem);
     if (def->heads)
         virBufferAsprintf(buf, " heads='%u'", def->heads);
     if (def->primary)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 8aa000a..ee36f49 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1271,6 +1271,7 @@ struct _virDomainVideoDef {
     int type;
     unsigned int ram;  /* kibibytes (multiples of 1024) */
     unsigned int vram; /* kibibytes (multiples of 1024) */
+    unsigned int vgamem; /* kibibytes (multiples of 1024) */
     unsigned int heads;
     bool primary;
     virDomainVideoAccelDefPtr accel;
@@ -2601,6 +2602,7 @@ virDomainFSDefPtr virDomainFSRemove(virDomainDefPtr def, size_t i);
 int virDomainVideoDefaultType(const virDomainDef *def);
 unsigned int virDomainVideoDefaultRAM(const virDomainDef *def,
                                       const virDomainVideoType type);
+unsigned int virDomainVideoDefaultVgamem(const virDomainVideoType type);
 
 int virDomainObjListNumOfDomains(virDomainObjListPtr doms,
                                  bool active,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 9d5c814..137ab0a 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -422,6 +422,7 @@ virDomainVcpuPinFindByVcpu;
 virDomainVcpuPinIsDuplicate;
 virDomainVideoDefaultRAM;
 virDomainVideoDefaultType;
+virDomainVideoDefaultVgamem;
 virDomainVideoDefFree;
 virDomainVideoTypeFromString;
 virDomainVideoTypeToString;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 92d6a8f..2da0d58 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4972,6 +4972,27 @@ qemuBuildDeviceVideoStr(virDomainDefPtr def,
         virBufferAsprintf(&buf, ",vram_size=%u", video->vram * 1024);
     }
 
+
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE) &&
+        video->vgamem &&
+        ((video->type == VIR_DOMAIN_VIDEO_TYPE_CIRRUS &&
+          virQEMUCapsGet(qemuCaps, QEMU_CAPS_CIRRUS_VGA_VGAMEM)) ||
+         (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL &&
+          virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGA_VGAMEM)) ||
+         (video->type == VIR_DOMAIN_VIDEO_TYPE_VGA &&
+          virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM)) ||
+         (video->type == VIR_DOMAIN_VIDEO_TYPE_VMVGA &&
+          virQEMUCapsGet(qemuCaps, QEMU_CAPS_VMWARE_SVGA_VGAMEM)))) {
+
+        if (video->vgamem % 1024) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           "%s", _("value for 'vgamem' must be multiple of 1024"));
+            goto error;
+        }
+
+        virBufferAsprintf(&buf, ",vgamem_mb=%u", video->vgamem / 1024);
+    }
+
     if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) < 0)
         goto error;
 
@@ -9299,6 +9320,29 @@ qemuBuildCommandLine(virConnectPtr conn,
                                                dev, vram * 1024);
                     }
                 }
+
+                if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE) &&
+                    def->videos[0]->vgamem &&
+                    ((primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_CIRRUS &&
+                      virQEMUCapsGet(qemuCaps, QEMU_CAPS_CIRRUS_VGA_VGAMEM)) ||
+                     (primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_QXL &&
+                      virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGA_VGAMEM)) ||
+                     (primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VGA &&
+                      virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM)) ||
+                     (primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VMVGA &&
+                      virQEMUCapsGet(qemuCaps, QEMU_CAPS_VMWARE_SVGA_VGAMEM)))) {
+                    unsigned int vgamem = def->videos[0]->vgamem;
+
+                    if (vgamem % 1024) {
+                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                                       "%s", _("value for 'vgamem' must be multiple of 1024"));
+                        goto error;
+                    }
+
+                    virCommandAddArg(cmd, "-global");
+                    virCommandAddArgFormat(cmd, "%s.vgamem_mb=%u",
+                                           dev, vgamem / 1024);
+                }
             }
 
             if (def->nvideos > 1) {
@@ -12297,6 +12341,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
         vid->vram = virDomainVideoDefaultRAM(def, vid->type);
         vid->ram = vid->type == VIR_DOMAIN_VIDEO_TYPE_QXL ?
                        virDomainVideoDefaultRAM(def, vid->type) : 0;
+        vid->vgamem = virDomainVideoDefaultVgamem(vid->type);
         vid->heads = 1;
 
         if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, vid) < 0) {
diff --git a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml
index ec1c6e8..980c589 100644
--- a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml
+++ b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml
@@ -91,7 +91,7 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </sound>
     <video>
-      <model type='cirrus' vram='9216' heads='1'/>
+      <model type='cirrus' vram='9216' vgamem='16384' heads='1'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='virtio'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml
index 4d4ac47..2c425bc 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml
@@ -88,7 +88,7 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </sound>
     <video>
-      <model type='cirrus' vram='9216' heads='1'/>
+      <model type='cirrus' vram='9216' vgamem='16384' heads='1'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='virtio'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml
index 98b7d6a..3ab386e 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml
@@ -28,7 +28,7 @@
       <listen type='network' network='Bobsnetwork'/>
     </graphics>
     <video>
-      <model type='cirrus' vram='9216' heads='1'/>
+      <model type='cirrus' vram='9216' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='virtio'/>
   </devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml
index 0177654..cd2a09c 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml
@@ -27,7 +27,7 @@
     <input type='keyboard' bus='ps2'/>
     <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority' fullscreen='yes'/>
     <video>
-      <model type='cirrus' vram='9216' heads='1'/>
+      <model type='cirrus' vram='9216' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml
index 6bebd10..5914043 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml
@@ -27,7 +27,7 @@
     <input type='keyboard' bus='ps2'/>
     <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority'/>
     <video>
-      <model type='vga' vram='9216' heads='1'/>
+      <model type='vga' vram='9216' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
index 6c913b4..8163020 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
@@ -33,10 +33,10 @@
       <streaming mode='filter'/>
     </graphics>
     <video>
-      <model type='qxl' ram='65536' vram='18432' heads='1'/>
+      <model type='qxl' ram='65536' vram='18432' vgamem='16384' heads='1'/>
     </video>
     <video>
-      <model type='qxl' ram='65536' vram='32768' heads='1'/>
+      <model type='qxl' ram='65536' vram='32768' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='virtio'/>
   </devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
index acf3019..a12206b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
@@ -30,10 +30,10 @@
       <channel name='inputs' mode='insecure'/>
     </graphics>
     <video>
-      <model type='qxl' ram='65536' vram='32768' heads='1'/>
+      <model type='qxl' ram='65536' vram='32768' vgamem='16384' heads='1'/>
     </video>
     <video>
-      <model type='qxl' ram='65536' vram='65536' heads='1'/>
+      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='virtio'/>
   </devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
index 8f58149..9396056 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
@@ -37,10 +37,10 @@
       <filetransfer enable='no'/>
     </graphics>
     <video>
-      <model type='qxl' ram='65536' vram='18432' heads='1'/>
+      <model type='qxl' ram='65536' vram='18432' vgamem='16384' heads='1'/>
     </video>
     <video>
-      <model type='qxl' ram='65536' vram='32768' heads='1'/>
+      <model type='qxl' ram='65536' vram='32768' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='virtio'/>
   </devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml
index 694343f..df51e94 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml
@@ -29,7 +29,7 @@
       <listen type='address' address='127.0.0.1'/>
     </graphics>
     <video>
-      <model type='cirrus' vram='9216' heads='1'/>
+      <model type='cirrus' vram='9216' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml
index b35c2bd..f8fd723 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml
@@ -29,7 +29,7 @@
       <listen type='address' address='127.0.0.1'/>
     </graphics>
     <video>
-      <model type='cirrus' vram='9216' heads='1'/>
+      <model type='cirrus' vram='9216' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml
index 44df226..322ccdd 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml
@@ -27,7 +27,7 @@
     <input type='keyboard' bus='ps2'/>
     <graphics type='vnc' socket='/tmp/foo.socket'/>
     <video>
-      <model type='cirrus' vram='9216' heads='1'/>
+      <model type='cirrus' vram='9216' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml
index b35c2bd..f8fd723 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml
@@ -29,7 +29,7 @@
       <listen type='address' address='127.0.0.1'/>
     </graphics>
     <video>
-      <model type='cirrus' vram='9216' heads='1'/>
+      <model type='cirrus' vram='9216' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-websocket.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-websocket.xml
index cfa61be..982ddcd 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-websocket.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-websocket.xml
@@ -22,7 +22,7 @@
       <listen type='address' address='127.0.0.1'/>
     </graphics>
     <video>
-      <model type='cirrus' vram='9216' heads='1'/>
+      <model type='cirrus' vram='9216' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml
index 356ac36..3b2f76b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml
@@ -29,7 +29,7 @@
       <listen type='address' address='2001:1:2:3:4:5:1234:1234'/>
     </graphics>
     <video>
-      <model type='cirrus' vram='9216' heads='1'/>
+      <model type='cirrus' vram='9216' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml
index f70e20a..7a4d8b4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml
@@ -66,7 +66,7 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </sound>
     <video>
-      <model type='vga' vram='9216' heads='1'/>
+      <model type='vga' vram='9216' vgamem='16384' heads='1'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='virtio'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml b/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml
index a1cb38c..7782a43 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml
@@ -201,7 +201,7 @@
       <listen type='address' address='127.0.0.1'/>
     </graphics>
     <video>
-      <model type='cirrus' vram='9216' heads='1'/>
+      <model type='cirrus' vram='9216' vgamem='16384' heads='1'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='virtio'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.xml b/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.xml
index ee151be..68f78a4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.xml
@@ -26,7 +26,7 @@
     <controller type='pci' index='2' model='pci-bridge'/>
     <controller type='sata' index='0'/>
     <video>
-      <model type='qxl' ram='65536' vram='18432' heads='1'/>
+      <model type='qxl' ram='65536' vram='18432' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml
index 1f896f8..3df6cc6 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml
@@ -34,7 +34,7 @@
     <input type='mouse' bus='usb'/>
     <graphics type='sdl'/>
     <video>
-      <model type='cirrus' vram='9216' heads='1'/>
+      <model type='cirrus' vram='9216' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.xml
index 36af468..47fabe9 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.xml
@@ -37,7 +37,7 @@
       <listen type='address' address='127.0.0.1'/>
     </graphics>
     <video>
-      <model type='qxl' ram='65535' vram='65535' heads='1'/>
+      <model type='qxl' ram='65535' vram='65535' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='virtio'/>
   </devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.args b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.args
new file mode 100644
index 0000000..92e343f
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
+-hda /var/lib/libvirt/images/QEMUGuest1 \
+-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=16\
+,bus=pci.0,addr=0x2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.xml
new file mode 100644
index 0000000..d2b6978
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/var/lib/libvirt/images/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <video>
+      <model type='qxl' vgamem='16384' heads='1'/>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.args b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.args
new file mode 100644
index 0000000..c9eb535
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
+-hda /var/lib/libvirt/images/QEMUGuest1 \
+-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0\
+,addr=0x2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.xml
new file mode 100644
index 0000000..d2b6978
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/var/lib/libvirt/images/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <video>
+      <model type='qxl' vgamem='16384' heads='1'/>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.args b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.args
new file mode 100644
index 0000000..a6ac6d8
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.args
@@ -0,0 +1,5 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
+-hda /var/lib/libvirt/images/QEMUGuest1 -net none -serial none -parallel none \
+-vga qxl
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.xml
new file mode 100644
index 0000000..d2b6978
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/var/lib/libvirt/images/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <video>
+      <model type='qxl' vgamem='16384' heads='1'/>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.args b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.args
new file mode 100644
index 0000000..51fc524
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.args
@@ -0,0 +1,8 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
+-hda /var/lib/libvirt/images/QEMUGuest1 \
+-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=16\
+,bus=pci.0,addr=0x2 -device qxl,id=video1,ram_size=67108864,vram_size=67108864\
+,vgamem_mb=16,bus=pci.0,addr=0x4 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.xml
new file mode 100644
index 0000000..2b66781
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.xml
@@ -0,0 +1,32 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/var/lib/libvirt/images/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <video>
+      <model type='qxl' vgamem='16384' heads='1'/>
+    </video>
+    <video>
+      <model type='qxl' vgamem='16384' heads='1'/>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.args b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.args
new file mode 100644
index 0000000..208408e
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
+-hda /var/lib/libvirt/images/QEMUGuest1 \
+-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0\
+,addr=0x2 -device qxl,id=video1,ram_size=67108864,vram_size=67108864,bus=pci.0\
+,addr=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.xml
new file mode 100644
index 0000000..2b66781
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.xml
@@ -0,0 +1,32 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/var/lib/libvirt/images/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <video>
+      <model type='qxl' vgamem='16384' heads='1'/>
+    </video>
+    <video>
+      <model type='qxl' vgamem='16384' heads='1'/>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-nodevice.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-nodevice.xml
new file mode 100644
index 0000000..2b66781
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-nodevice.xml
@@ -0,0 +1,32 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/var/lib/libvirt/images/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <video>
+      <model type='qxl' vgamem='16384' heads='1'/>
+    </video>
+    <video>
+      <model type='qxl' vgamem='16384' heads='1'/>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.args b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.args
new file mode 100644
index 0000000..81e4aec
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
+-hda /var/lib/libvirt/images/QEMUGuest1 \
+-device VGA,id=video0,vgamem_mb=16,bus=pci.0,addr=0x2 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.xml
new file mode 100644
index 0000000..14a1044
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/var/lib/libvirt/images/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <video>
+      <model type='vga' vgamem='16384' heads='1'/>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.args b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.args
new file mode 100644
index 0000000..f822280
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
+-hda /var/lib/libvirt/images/QEMUGuest1 \
+-device VGA,id=video0,bus=pci.0,addr=0x2 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.xml
new file mode 100644
index 0000000..14a1044
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/var/lib/libvirt/images/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <video>
+      <model type='vga' vgamem='16384' heads='1'/>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.args b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.args
new file mode 100644
index 0000000..7b5f151
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.args
@@ -0,0 +1,5 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
+-hda /var/lib/libvirt/images/QEMUGuest1 -net none -serial none -parallel none \
+-vga std
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.xml
new file mode 100644
index 0000000..14a1044
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/var/lib/libvirt/images/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <video>
+      <model type='vga' vgamem='16384' heads='1'/>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 0e9fab9..47d6c95 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1322,6 +1322,24 @@ mymain(void)
             QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
             QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_QXL_VGA,
             QEMU_CAPS_DEVICE_PCI_BRIDGE);
+    DO_TEST("video-vga-nodevice", QEMU_CAPS_VGA);
+    DO_TEST("video-vga-device", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VGA,
+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
+    DO_TEST("video-vga-device-vgamem", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VGA,
+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_VGAMEM);
+    DO_TEST("video-qxl-nodevice", QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL);
+    DO_TEST("video-qxl-device", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_QXL_VGA,
+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
+    DO_TEST("video-qxl-device-vgamem", QEMU_CAPS_DEVICE,
+            QEMU_CAPS_DEVICE_QXL_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+            QEMU_CAPS_QXL_VGA_VGAMEM);
+    DO_TEST_FAILURE("video-qxl-sec-nodevice", QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL);
+    DO_TEST("video-qxl-sec-device", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_QXL_VGA,
+            QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
+    DO_TEST("video-qxl-sec-device-vgamem", QEMU_CAPS_DEVICE,
+            QEMU_CAPS_DEVICE_QXL_VGA, QEMU_CAPS_DEVICE_QXL,
+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_QXL_VGA_VGAMEM,
+            QEMU_CAPS_QXL_VGAMEM);
 
     DO_TEST("virtio-rng-default", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIRTIO_RNG,
             QEMU_CAPS_OBJECT_RNG_RANDOM);
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml
index ae40805..7dfa319 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml
@@ -29,7 +29,7 @@
       <listen type='network' network='Bobsnetwork'/>
     </graphics>
     <video>
-      <model type='cirrus' vram='9216' heads='1'/>
+      <model type='cirrus' vram='9216' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='virtio'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
index 73ebcab..a0b0b46 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
@@ -80,7 +80,7 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </sound>
     <video>
-      <model type='vga' vram='9216' heads='1'/>
+      <model type='vga' vram='9216' vgamem='16384' heads='1'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='virtio'>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml
index 13f0f5d..b47e1ca 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml
@@ -34,7 +34,7 @@
     </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <video>
-      <model type='cirrus' vram='9216' heads='1'/>
+      <model type='cirrus' vram='9216' vgamem='16384' heads='1'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='virtio'>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml
index 8748437..8f83624 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml
@@ -35,7 +35,7 @@
     <controller type='pci' index='8' model='pci-bridge'/>
     <controller type='pci' index='0' model='pci-root'/>
     <video>
-      <model type='cirrus' vram='9216' heads='1'/>
+      <model type='cirrus' vram='9216' vgamem='16384' heads='1'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='virtio'>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml
index 96f8eaf..aa24cc8 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml
@@ -24,7 +24,7 @@
     <controller type='pci' index='2' model='pci-bridge'/>
     <controller type='sata' index='0'/>
     <video>
-      <model type='qxl' ram='65536' vram='18432' heads='1'/>
+      <model type='qxl' ram='65536' vram='18432' vgamem='16384' heads='1'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none-relabel.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none-relabel.xml
index 1b36533..ffcb63f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none-relabel.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none-relabel.xml
@@ -42,7 +42,7 @@
       <listen type='address' address='0.0.0.0'/>
     </graphics>
     <video>
-      <model type='cirrus' vram='8192' heads='1'/>
+      <model type='cirrus' vram='8192' vgamem='16384' heads='1'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='virtio'>
-- 
2.0.4




More information about the libvir-list mailing list