edecca
From 2010df9c6a8a4ff984e3f1b697398da648342953 Mon Sep 17 00:00:00 2001
edecca
Message-Id: <2010df9c6a8a4ff984e3f1b697398da648342953@dist-git>
edecca
From: Erik Skultety <eskultet@redhat.com>
edecca
Date: Thu, 19 Jul 2018 15:04:05 +0200
edecca
Subject: [PATCH] conf: Introduce new video type 'none'
edecca
MIME-Version: 1.0
edecca
Content-Type: text/plain; charset=UTF-8
edecca
Content-Transfer-Encoding: 8bit
edecca
edecca
Historically, we've always enabled an emulated video device every time we
edecca
see that graphics should be supported with a guest. With the appearance
edecca
of mediated devices which can support QEMU's vfio-display capability,
edecca
users might want to use such a device as the only video device.
edecca
Therefore introduce a new, effectively a 'disable', type for video
edecca
device.
edecca
edecca
Reviewed-by: Ján Tomko <jtomko@redhat.com>
edecca
Signed-off-by: Erik Skultety <eskultet@redhat.com>
edecca
(cherry picked from commit d48813e81af798e3027edcc2f41be2630111ba65)
edecca
edecca
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
edecca
Signed-off-by: Erik Skultety <eskultet@redhat.com>
edecca
Reviewed-by: Ján Tomko <jtomko@redhat.com>
edecca
---
edecca
 docs/formatdomain.html.in                     | 13 +++-
edecca
 docs/schemas/domaincommon.rng                 |  1 +
edecca
 src/conf/domain_conf.c                        | 61 +++++++++++++------
edecca
 src/conf/domain_conf.h                        |  1 +
edecca
 src/qemu/qemu_command.c                       | 12 +++-
edecca
 src/qemu/qemu_domain.c                        |  2 +
edecca
 src/qemu/qemu_domain_address.c                |  7 ++-
edecca
 tests/domaincapsschemadata/full.xml           |  1 +
edecca
 .../video-invalid-multiple-devices.xml        | 33 ++++++++++
edecca
 tests/qemuxml2argvdata/video-none-device.args | 27 ++++++++
edecca
 tests/qemuxml2argvdata/video-none-device.xml  | 39 ++++++++++++
edecca
 tests/qemuxml2argvtest.c                      |  4 +-
edecca
 .../qemuxml2xmloutdata/video-none-device.xml  | 42 +++++++++++++
edecca
 tests/qemuxml2xmltest.c                       |  1 +
edecca
 14 files changed, 220 insertions(+), 24 deletions(-)
edecca
 create mode 100644 tests/qemuxml2argvdata/video-invalid-multiple-devices.xml
edecca
 create mode 100644 tests/qemuxml2argvdata/video-none-device.args
edecca
 create mode 100644 tests/qemuxml2argvdata/video-none-device.xml
edecca
 create mode 100644 tests/qemuxml2xmloutdata/video-none-device.xml
edecca
edecca
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
edecca
index 0e8f0a125f..42acf7a828 100644
edecca
--- a/docs/formatdomain.html.in
edecca
+++ b/docs/formatdomain.html.in
edecca
@@ -6666,9 +6666,18 @@ qemu-kvm -net nic,model=? /dev/null
edecca
           The model element has a mandatory type
edecca
           attribute which takes the value "vga", "cirrus", "vmvga", "xen",
edecca
           "vbox", "qxl" (since 0.8.6),
edecca
-          "virtio" (since 1.3.0)
edecca
-          or "gop" (since 3.2.0)
edecca
+          "virtio" (since 1.3.0),
edecca
+          "gop" (since 3.2.0), or
edecca
+          "none" (since 4.6.0)
edecca
           depending on the hypervisor features available.
edecca
+          The purpose of the type none is to instruct libvirt not
edecca
+          to add a default video device in the guest (see the paragraph above).
edecca
+          This legacy behaviour can be inconvenient in cases where GPU mediated
edecca
+          devices are meant to be the only rendering device within a guest and
edecca
+          so specifying another video device along with type
edecca
+          none.
edecca
+          Refer to Host device assignment to see
edecca
+          how to add a mediated device into a guest.
edecca
         

edecca
         

edecca
           You can provide the amount of video memory in kibibytes (blocks of
edecca
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
edecca
index be8430ab22..ac04af51a1 100644
edecca
--- a/docs/schemas/domaincommon.rng
edecca
+++ b/docs/schemas/domaincommon.rng
edecca
@@ -3454,6 +3454,7 @@
edecca
                 <value>vbox</value>
edecca
                 <value>virtio</value>
edecca
                 <value>gop</value>
edecca
+                <value>none</value>
edecca
               </choice>
edecca
             </attribute>
edecca
             <group>
edecca
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
edecca
index 830c298158..23288aa01b 100644
edecca
--- a/src/conf/domain_conf.c
edecca
+++ b/src/conf/domain_conf.c
edecca
@@ -590,7 +590,8 @@ VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
edecca
               "qxl",
edecca
               "parallels",
edecca
               "virtio",
edecca
-              "gop")
edecca
+              "gop",
edecca
+              "none")
edecca
 
edecca
 VIR_ENUM_IMPL(virDomainVideoVGAConf, VIR_DOMAIN_VIDEO_VGACONF_LAST,
edecca
               "io",
edecca
@@ -5106,22 +5107,30 @@ virDomainDefPostParseVideo(virDomainDefPtr def,
edecca
     if (def->nvideos == 0)
edecca
         return 0;
edecca
 
edecca
-    virDomainDeviceDef device = {
edecca
-        .type = VIR_DOMAIN_DEVICE_VIDEO,
edecca
-        .data.video = def->videos[0],
edecca
-    };
edecca
+    if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_NONE) {
edecca
+        /* we don't want to format any values we automatically fill in for
edecca
+         * videos into the XML, so clear them
edecca
+         */
edecca
+        virDomainVideoDefClear(def->videos[0]);
edecca
+        def->videos[0]->type = VIR_DOMAIN_VIDEO_TYPE_NONE;
edecca
+    } else {
edecca
+        virDomainDeviceDef device = {
edecca
+            .type = VIR_DOMAIN_DEVICE_VIDEO,
edecca
+            .data.video = def->videos[0],
edecca
+        };
edecca
 
edecca
-    /* Mark the first video as primary. If the user specified
edecca
-     * primary="yes", the parser already inserted the device at
edecca
-     * def->videos[0]
edecca
-     */
edecca
-    def->videos[0]->primary = true;
edecca
+        /* Mark the first video as primary. If the user specified
edecca
+         * primary="yes", the parser already inserted the device at
edecca
+         * def->videos[0]
edecca
+         */
edecca
+        def->videos[0]->primary = true;
edecca
 
edecca
-    /* videos[0] might have been added in AddImplicitDevices, after we've
edecca
-     * done the per-device post-parse */
edecca
-    if (virDomainDefPostParseDeviceIterator(def, &device,
edecca
-                                            NULL, opaque) < 0)
edecca
-        return -1;
edecca
+        /* videos[0] might have been added in AddImplicitDevices, after we've
edecca
+         * done the per-device post-parse */
edecca
+        if (virDomainDefPostParseDeviceIterator(def, &device,
edecca
+                                                NULL, opaque) < 0)
edecca
+            return -1;
edecca
+    }
edecca
 
edecca
     return 0;
edecca
 }
edecca
@@ -5670,13 +5679,30 @@ virDomainHostdevDefValidate(const virDomainHostdevDef *hostdev)
edecca
 
edecca
 
edecca
 static int
edecca
-virDomainVideoDefValidate(const virDomainVideoDef *video)
edecca
+virDomainVideoDefValidate(const virDomainVideoDef *video,
edecca
+                          const virDomainDef *def)
edecca
 {
edecca
+    size_t i;
edecca
+
edecca
     if (video->type == VIR_DOMAIN_VIDEO_TYPE_DEFAULT) {
edecca
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
edecca
                        _("missing video model and cannot determine default"));
edecca
         return -1;
edecca
     }
edecca
+
edecca
+    /* it doesn't make sense to pair video device type 'none' with any other
edecca
+     * types, there can be only a single video device in such case
edecca
+     */
edecca
+    for (i = 0; i < def->nvideos; i++) {
edecca
+        if (def->videos[i]->type == VIR_DOMAIN_VIDEO_TYPE_NONE &&
edecca
+            def->nvideos > 1) {
edecca
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
edecca
+                           _("a '%s' video type must be the only video device "
edecca
+                             "defined for the domain"));
edecca
+            return -1;
edecca
+        }
edecca
+    }
edecca
+
edecca
     return 0;
edecca
 }
edecca
 
edecca
@@ -5738,7 +5764,7 @@ virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev,
edecca
         return virDomainHostdevDefValidate(dev->data.hostdev);
edecca
 
edecca
     case VIR_DOMAIN_DEVICE_VIDEO:
edecca
-        return virDomainVideoDefValidate(dev->data.video);
edecca
+        return virDomainVideoDefValidate(dev->data.video, def);
edecca
 
edecca
     case VIR_DOMAIN_DEVICE_MEMORY:
edecca
         return virDomainMemoryDefValidate(dev->data.memory);
edecca
@@ -15048,6 +15074,7 @@ virDomainVideoDefaultRAM(const virDomainDef *def,
edecca
     case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
edecca
     case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
edecca
     case VIR_DOMAIN_VIDEO_TYPE_GOP:
edecca
+    case VIR_DOMAIN_VIDEO_TYPE_NONE:
edecca
     case VIR_DOMAIN_VIDEO_TYPE_LAST:
edecca
     default:
edecca
         return 0;
edecca
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
edecca
index 8ca9558ceb..5e2f21dea3 100644
edecca
--- a/src/conf/domain_conf.h
edecca
+++ b/src/conf/domain_conf.h
edecca
@@ -1424,6 +1424,7 @@ typedef enum {
edecca
     VIR_DOMAIN_VIDEO_TYPE_PARALLELS, /* pseudo device for VNC in containers */
edecca
     VIR_DOMAIN_VIDEO_TYPE_VIRTIO,
edecca
     VIR_DOMAIN_VIDEO_TYPE_GOP,
edecca
+    VIR_DOMAIN_VIDEO_TYPE_NONE,
edecca
 
edecca
     VIR_DOMAIN_VIDEO_TYPE_LAST
edecca
 } virDomainVideoType;
edecca
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
edecca
index 1fce45134f..954265feb0 100644
edecca
--- a/src/qemu/qemu_command.c
edecca
+++ b/src/qemu/qemu_command.c
edecca
@@ -105,7 +105,8 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
edecca
               "qxl",
edecca
               "", /* don't support parallels */
edecca
               "", /* no need for virtio */
edecca
-              "" /* don't support gop */);
edecca
+              "" /* don't support gop */,
edecca
+              "" /* 'none' doesn't make sense here */);
edecca
 
edecca
 VIR_ENUM_DECL(qemuDeviceVideo)
edecca
 
edecca
@@ -119,7 +120,8 @@ VIR_ENUM_IMPL(qemuDeviceVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
edecca
               "qxl-vga",
edecca
               "", /* don't support parallels */
edecca
               "virtio-vga",
edecca
-              "" /* don't support gop */);
edecca
+              "" /* don't support gop */,
edecca
+              "" /* 'none' doesn't make sense here */);
edecca
 
edecca
 VIR_ENUM_DECL(qemuDeviceVideoSecondary)
edecca
 
edecca
@@ -133,7 +135,8 @@ VIR_ENUM_IMPL(qemuDeviceVideoSecondary, VIR_DOMAIN_VIDEO_TYPE_LAST,
edecca
               "qxl",
edecca
               "", /* don't support parallels */
edecca
               "virtio-gpu",
edecca
-              "" /* don't support gop */);
edecca
+              "" /* don't support gop */,
edecca
+              "" /* 'none' doesn't make sense here */);
edecca
 
edecca
 VIR_ENUM_DECL(qemuSoundCodec)
edecca
 
edecca
@@ -4421,6 +4424,9 @@ qemuBuildVideoCommandLine(virCommandPtr cmd,
edecca
         char *str = NULL;
edecca
         virDomainVideoDefPtr video = def->videos[i];
edecca
 
edecca
+        if (video->type == VIR_DOMAIN_VIDEO_TYPE_NONE)
edecca
+            continue;
edecca
+
edecca
         if (video->primary) {
edecca
             if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY)) {
edecca
 
edecca
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
edecca
index 5337f1ce55..508846116b 100644
edecca
--- a/src/qemu/qemu_domain.c
edecca
+++ b/src/qemu/qemu_domain.c
edecca
@@ -4528,6 +4528,8 @@ static int
edecca
 qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video)
edecca
 {
edecca
     switch ((virDomainVideoType) video->type) {
edecca
+    case VIR_DOMAIN_VIDEO_TYPE_NONE:
edecca
+        return 0;
edecca
     case VIR_DOMAIN_VIDEO_TYPE_XEN:
edecca
     case VIR_DOMAIN_VIDEO_TYPE_VBOX:
edecca
     case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
edecca
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
edecca
index ab2ac022f1..e6996934b8 100644
edecca
--- a/src/qemu/qemu_domain_address.c
edecca
+++ b/src/qemu/qemu_domain_address.c
edecca
@@ -821,6 +821,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
edecca
 
edecca
         case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
edecca
         case VIR_DOMAIN_VIDEO_TYPE_GOP:
edecca
+        case VIR_DOMAIN_VIDEO_TYPE_NONE:
edecca
         case VIR_DOMAIN_VIDEO_TYPE_LAST:
edecca
             return 0;
edecca
         }
edecca
@@ -1532,7 +1533,8 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
edecca
             goto cleanup;
edecca
     }
edecca
 
edecca
-    if (def->nvideos > 0) {
edecca
+    if (def->nvideos > 0 &&
edecca
+        def->videos[0]->type != VIR_DOMAIN_VIDEO_TYPE_NONE) {
edecca
         /* Because the PIIX3 integrated IDE/USB controllers are
edecca
          * already at slot 1, when qemu looks for the first free slot
edecca
          * to place the VGA controller (which is always the first
edecca
@@ -1540,6 +1542,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
edecca
          * at slot 2.
edecca
          */
edecca
         virDomainVideoDefPtr primaryVideo = def->videos[0];
edecca
+
edecca
         if (virDeviceInfoPCIAddressWanted(&primaryVideo->info)) {
edecca
             memset(&tmp_addr, 0, sizeof(tmp_addr));
edecca
             tmp_addr.slot = 2;
edecca
@@ -2105,6 +2108,8 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
edecca
 
edecca
     /* Video devices */
edecca
     for (i = 0; i < def->nvideos; i++) {
edecca
+        if (def->videos[i]->type == VIR_DOMAIN_VIDEO_TYPE_NONE)
edecca
+            continue;
edecca
 
edecca
         if (!virDeviceInfoPCIAddressWanted(&def->videos[i]->info))
edecca
             continue;
edecca
diff --git a/tests/domaincapsschemadata/full.xml b/tests/domaincapsschemadata/full.xml
edecca
index 154c4a6fe9..eafba1ae5b 100644
edecca
--- a/tests/domaincapsschemadata/full.xml
edecca
+++ b/tests/domaincapsschemadata/full.xml
edecca
@@ -74,6 +74,7 @@
edecca
         <value>parallels</value>
edecca
         <value>virtio</value>
edecca
         <value>gop</value>
edecca
+        <value>none</value>
edecca
       </enum>
edecca
     </video>
edecca
     <hostdev supported='yes'>
edecca
diff --git a/tests/qemuxml2argvdata/video-invalid-multiple-devices.xml b/tests/qemuxml2argvdata/video-invalid-multiple-devices.xml
edecca
new file mode 100644
edecca
index 0000000000..3f105efaae
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/video-invalid-multiple-devices.xml
edecca
@@ -0,0 +1,33 @@
edecca
+<domain type='qemu'>
edecca
+  <name>QEMUGuest1</name>
edecca
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
edecca
+  <memory unit='KiB'>219100</memory>
edecca
+  <currentMemory unit='KiB'>219100</currentMemory>
edecca
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
edecca
+  <os>
edecca
+    <type arch='i686' machine='pc'>hvm</type>
edecca
+    <boot dev='hd'/>
edecca
+  </os>
edecca
+  <clock offset='utc'/>
edecca
+  <on_poweroff>destroy</on_poweroff>
edecca
+  <on_reboot>restart</on_reboot>
edecca
+  <on_crash>destroy</on_crash>
edecca
+  <devices>
edecca
+    <emulator>/usr/bin/qemu-system-i686</emulator>
edecca
+    <disk type='block' device='disk'>
edecca
+      <source dev='/dev/HostVG/QEMUGuest1'/>
edecca
+      <target dev='hda' bus='ide'/>
edecca
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
edecca
+    </disk>
edecca
+    <controller type='usb' index='0'/>
edecca
+    <controller type='ide' index='0'/>
edecca
+    <controller type='pci' index='0' model='pci-root'/>
edecca
+    <video>
edecca
+      <model type='qxl'/>
edecca
+    </video>
edecca
+    <video>
edecca
+      <model type='none'/>
edecca
+    </video>
edecca
+    <memballoon model='virtio'/>
edecca
+  </devices>
edecca
+</domain>
edecca
diff --git a/tests/qemuxml2argvdata/video-none-device.args b/tests/qemuxml2argvdata/video-none-device.args
edecca
new file mode 100644
edecca
index 0000000000..1b03c0cb97
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/video-none-device.args
edecca
@@ -0,0 +1,27 @@
edecca
+LC_ALL=C \
edecca
+PATH=/bin \
edecca
+HOME=/home/test \
edecca
+USER=test \
edecca
+LOGNAME=test \
edecca
+QEMU_AUDIO_DRV=none \
edecca
+/usr/bin/qemu-system-i686 \
edecca
+-name QEMUGuest1 \
edecca
+-S \
edecca
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
edecca
+-m 214 \
edecca
+-smp 1,sockets=1,cores=1,threads=1 \
edecca
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
edecca
+-no-user-config \
edecca
+-nodefaults \
edecca
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
edecca
+server,nowait \
edecca
+-mon chardev=charmonitor,id=monitor,mode=control \
edecca
+-rtc base=utc \
edecca
+-no-shutdown \
edecca
+-no-acpi \
edecca
+-boot c \
edecca
+-usb \
edecca
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
edecca
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
edecca
+-vnc 127.0.0.1:0 \
edecca
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
edecca
diff --git a/tests/qemuxml2argvdata/video-none-device.xml b/tests/qemuxml2argvdata/video-none-device.xml
edecca
new file mode 100644
edecca
index 0000000000..4b591562b7
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/video-none-device.xml
edecca
@@ -0,0 +1,39 @@
edecca
+<domain type='qemu'>
edecca
+  <name>QEMUGuest1</name>
edecca
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
edecca
+  <memory unit='KiB'>219136</memory>
edecca
+  <currentMemory unit='KiB'>219136</currentMemory>
edecca
+  <vcpu placement='static'>1</vcpu>
edecca
+  <os>
edecca
+    <type arch='i686' machine='pc'>hvm</type>
edecca
+    <boot dev='hd'/>
edecca
+  </os>
edecca
+  <clock offset='utc'/>
edecca
+  <on_poweroff>destroy</on_poweroff>
edecca
+  <on_reboot>restart</on_reboot>
edecca
+  <on_crash>destroy</on_crash>
edecca
+  <devices>
edecca
+    <emulator>/usr/bin/qemu-system-i686</emulator>
edecca
+    <disk type='block' device='disk'>
edecca
+      <source dev='/dev/HostVG/QEMUGuest1'/>
edecca
+      <target dev='hda' bus='ide'/>
edecca
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
edecca
+    </disk>
edecca
+    <controller type='usb' index='0'>
edecca
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
edecca
+    </controller>
edecca
+    <controller type='ide' index='0'>
edecca
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
edecca
+    </controller>
edecca
+    <controller type='pci' index='0' model='pci-root'/>
edecca
+    <input type='mouse' bus='ps2'/>
edecca
+    <input type='keyboard' bus='ps2'/>
edecca
+    <graphics type='vnc'/>
edecca
+    <video>
edecca
+      <model type='none'/>
edecca
+    </video>
edecca
+    <memballoon model='virtio'>
edecca
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
edecca
+    </memballoon>
edecca
+  </devices>
edecca
+</domain>
edecca
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
edecca
index 9237a4fb89..3cff4ffb5e 100644
edecca
--- a/tests/qemuxml2argvtest.c
edecca
+++ b/tests/qemuxml2argvtest.c
edecca
@@ -1998,7 +1998,9 @@ mymain(void)
edecca
             QEMU_CAPS_DEVICE_VIRTIO_VGA,
edecca
             QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
edecca
             QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS);
edecca
-    DO_TEST_PARSE_ERROR("video-invalid", NONE);
edecca
+    DO_TEST("video-none-device",
edecca
+            QEMU_CAPS_VNC);
edecca
+    DO_TEST_PARSE_ERROR("video-invalid-multiple-devices", NONE);
edecca
 
edecca
     DO_TEST("virtio-rng-default",
edecca
             QEMU_CAPS_DEVICE_VIRTIO_RNG,
edecca
diff --git a/tests/qemuxml2xmloutdata/video-none-device.xml b/tests/qemuxml2xmloutdata/video-none-device.xml
edecca
new file mode 100644
edecca
index 0000000000..6e76b394fe
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2xmloutdata/video-none-device.xml
edecca
@@ -0,0 +1,42 @@
edecca
+<domain type='qemu'>
edecca
+  <name>QEMUGuest1</name>
edecca
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
edecca
+  <memory unit='KiB'>219136</memory>
edecca
+  <currentMemory unit='KiB'>219136</currentMemory>
edecca
+  <vcpu placement='static'>1</vcpu>
edecca
+  <os>
edecca
+    <type arch='i686' machine='pc'>hvm</type>
edecca
+    <boot dev='hd'/>
edecca
+  </os>
edecca
+  <clock offset='utc'/>
edecca
+  <on_poweroff>destroy</on_poweroff>
edecca
+  <on_reboot>restart</on_reboot>
edecca
+  <on_crash>destroy</on_crash>
edecca
+  <devices>
edecca
+    <emulator>/usr/bin/qemu-system-i686</emulator>
edecca
+    <disk type='block' device='disk'>
edecca
+      <driver name='qemu' type='raw'/>
edecca
+      <source dev='/dev/HostVG/QEMUGuest1'/>
edecca
+      <target dev='hda' bus='ide'/>
edecca
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
edecca
+    </disk>
edecca
+    <controller type='usb' index='0'>
edecca
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
edecca
+    </controller>
edecca
+    <controller type='ide' index='0'>
edecca
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
edecca
+    </controller>
edecca
+    <controller type='pci' index='0' model='pci-root'/>
edecca
+    <input type='mouse' bus='ps2'/>
edecca
+    <input type='keyboard' bus='ps2'/>
edecca
+    <graphics type='vnc' port='-1' autoport='yes'>
edecca
+      <listen type='address'/>
edecca
+    </graphics>
edecca
+    <video>
edecca
+      <model type='none'/>
edecca
+    </video>
edecca
+    <memballoon model='virtio'>
edecca
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
edecca
+    </memballoon>
edecca
+  </devices>
edecca
+</domain>
edecca
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
edecca
index e418e67f6c..e35644d479 100644
edecca
--- a/tests/qemuxml2xmltest.c
edecca
+++ b/tests/qemuxml2xmltest.c
edecca
@@ -1145,6 +1145,7 @@ mymain(void)
edecca
             QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS,
edecca
             QEMU_CAPS_VNC,
edecca
             QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW);
edecca
+    DO_TEST("video-none-device", NONE);
edecca
 
edecca
     DO_TEST("intel-iommu",
edecca
             QEMU_CAPS_DEVICE_INTEL_IOMMU);
edecca
-- 
edecca
2.18.0
edecca