From nobody Mon Feb 9 01:47:23 2026
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 153140814178644.54619995929056;
Thu, 12 Jul 2018 08:09:01 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com
[10.5.11.24])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id B65E47F7CE;
Thu, 12 Jul 2018 15:08:59 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 7267F308BDB0;
Thu, 12 Jul 2018 15:08:59 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2AB5318037ED;
Thu, 12 Jul 2018 15:08:59 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com
[10.11.54.6])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6CF8sIk024956 for ;
Thu, 12 Jul 2018 11:08:54 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 9823920389E2; Thu, 12 Jul 2018 15:08:54 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id EF23D20389E0;
Thu, 12 Jul 2018 15:08:53 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Thu, 12 Jul 2018 17:08:47 +0200
Message-Id:
In-Reply-To:
References:
In-Reply-To:
References:
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6
X-loop: libvir-list@redhat.com
Cc: Erik Skultety
Subject: [libvirt] [PATCH v2 2/3] conf: Introduce new video type 'none'
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]);
Thu, 12 Jul 2018 15:09:00 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
Content-Type: text/plain; charset="utf-8"
Historically, we've always enabled an emulated video device every time we
see that graphics should be supported with a guest. With the appearance
of mediated devices which can support QEMU's vfio-display capability,
users might want to use such a device as the only video device.
Therefore introduce a new, effectively a 'disable', type for video
device.
Signed-off-by: Erik Skultety
Reviewed-by: J=EF=BF=BDn Tomko
---
docs/formatdomain.html.in | 13 ++++-
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_conf.c | 55 ++++++++++++++++--=
----
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 14 ++++--
src/qemu/qemu_domain.c | 3 ++
src/qemu/qemu_domain_address.c | 10 ++++
tests/domaincapsschemadata/full.xml | 1 +
.../video-invalid-multiple-devices.xml | 33 +++++++++++++
tests/qemuxml2argvdata/video-none-device.args | 27 +++++++++++
tests/qemuxml2argvdata/video-none-device.xml | 39 +++++++++++++++
tests/qemuxml2argvtest.c | 4 +-
tests/qemuxml2xmloutdata/video-none-device.xml | 42 +++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
14 files changed, 223 insertions(+), 21 deletions(-)
create mode 100644 tests/qemuxml2argvdata/video-invalid-multiple-devices.x=
ml
create mode 100644 tests/qemuxml2argvdata/video-none-device.args
create mode 100644 tests/qemuxml2argvdata/video-none-device.xml
create mode 100644 tests/qemuxml2xmloutdata/video-none-device.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 84ab5a9d12..03d94f0533 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6622,9 +6622,18 @@ qemu-kvm -net nic,model=3D? /dev/null
The model element has a mandatory type
attribute which takes the value "vga", "cirrus", "vmvga", "xen",
"vbox", "qxl" (since 0.8.6),
- "virtio" (since 1.3.0)
- or "gop" (since 3.2.0)
+ "virtio" (since 1.3.0),
+ "gop" (since 3.2.0), or
+ "none" (since 4.6.0)
depending on the hypervisor features available.
+ The purpose of the type none is to instruct libvirt=
not
+ to add a default video device in the guest (see the paragraph ab=
ove).
+ This legacy behaviour can be inconvenient in cases where GPU med=
iated
+ devices are meant to be the only rendering device within a guest=
and
+ so specifying another video device along with type
+ none.
+ Refer to Host device assignment to=
see
+ how to add a mediated device into a guest.
You can provide the amount of video memory in kibibytes (blocks =
of
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index bd687ce9d3..ed989c000f 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3451,6 +3451,7 @@
vboxvirtiogop
+ none
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7396616eda..d4927f0226 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -590,7 +590,8 @@ VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAS=
T,
"qxl",
"parallels",
"virtio",
- "gop")
+ "gop",
+ "none")
=20
VIR_ENUM_IMPL(virDomainVideoVGAConf, VIR_DOMAIN_VIDEO_VGACONF_LAST,
"io",
@@ -5091,25 +5092,48 @@ static int
virDomainDefPostParseVideo(virDomainDefPtr def,
void *opaque)
{
+ size_t i;
+
if (def->nvideos =3D=3D 0)
return 0;
=20
- virDomainDeviceDef device =3D {
- .type =3D VIR_DOMAIN_DEVICE_VIDEO,
- .data.video =3D def->videos[0],
- };
-
- /* Mark the first video as primary. If the user specified
- * primary=3D"yes", the parser already inserted the device at
- * def->videos[0]
+ /* it doesn't make sense to pair video device type 'none' with any oth=
er
+ * types, there can be only a single video device in such case
*/
- def->videos[0]->primary =3D true;
+ for (i =3D 0; i < def->nvideos; i++) {
+ if (def->videos[i]->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_NONE &&
+ def->nvideos > 1) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("a '%s' video type must be the only video dev=
ice "
+ "defined for the domain"));
+ return -1;
+ }
+ }
=20
- /* videos[0] might have been added in AddImplicitDevices, after we've
- * done the per-device post-parse */
- if (virDomainDefPostParseDeviceIterator(def, &device,
- NULL, opaque) < 0)
- return -1;
+ if (def->videos[0]->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_NONE) {
+ /* we don't want to format any values we automatically fill in for
+ * videos into the XML, so clear them
+ */
+ virDomainVideoDefClear(def->videos[0]);
+ def->videos[0]->type =3D VIR_DOMAIN_VIDEO_TYPE_NONE;
+ } else {
+ virDomainDeviceDef device =3D {
+ .type =3D VIR_DOMAIN_DEVICE_VIDEO,
+ .data.video =3D def->videos[0],
+ };
+
+ /* Mark the first video as primary. If the user specified
+ * primary=3D"yes", the parser already inserted the device at
+ * def->videos[0]
+ */
+ def->videos[0]->primary =3D true;
+
+ /* videos[0] might have been added in AddImplicitDevices, after we=
've
+ * done the per-device post-parse */
+ if (virDomainDefPostParseDeviceIterator(def, &device,
+ NULL, opaque) < 0)
+ return -1;
+ }
=20
return 0;
}
@@ -15023,6 +15047,7 @@ virDomainVideoDefaultRAM(const virDomainDef *def,
case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
case VIR_DOMAIN_VIDEO_TYPE_GOP:
+ case VIR_DOMAIN_VIDEO_TYPE_NONE:
case VIR_DOMAIN_VIDEO_TYPE_LAST:
default:
return 0;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 0f10e242fd..fe2fcdc081 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1423,6 +1423,7 @@ typedef enum {
VIR_DOMAIN_VIDEO_TYPE_PARALLELS, /* pseudo device for VNC in container=
s */
VIR_DOMAIN_VIDEO_TYPE_VIRTIO,
VIR_DOMAIN_VIDEO_TYPE_GOP,
+ VIR_DOMAIN_VIDEO_TYPE_NONE,
=20
VIR_DOMAIN_VIDEO_TYPE_LAST
} virDomainVideoType;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 44ae8dcef7..545b979a6f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -105,7 +105,8 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
"qxl",
"", /* don't support parallels */
"", /* no need for virtio */
- "" /* don't support gop */);
+ "" /* don't support gop */,
+ "none" /* no display */);
=20
VIR_ENUM_DECL(qemuDeviceVideo)
=20
@@ -119,7 +120,8 @@ VIR_ENUM_IMPL(qemuDeviceVideo, VIR_DOMAIN_VIDEO_TYPE_LA=
ST,
"qxl-vga",
"", /* don't support parallels */
"virtio-vga",
- "" /* don't support gop */);
+ "" /* don't support gop */,
+ "none" /* no display */);
=20
VIR_ENUM_DECL(qemuDeviceVideoSecondary)
=20
@@ -133,7 +135,8 @@ VIR_ENUM_IMPL(qemuDeviceVideoSecondary, VIR_DOMAIN_VIDE=
O_TYPE_LAST,
"qxl",
"", /* don't support parallels */
"virtio-gpu",
- "" /* don't support gop */);
+ "" /* don't support gop */,
+ "" /* 'none' doesn't make sense here */);
=20
VIR_ENUM_DECL(qemuSoundCodec)
=20
@@ -4447,6 +4450,11 @@ qemuBuildVideoCommandLine(virCommandPtr cmd,
{
size_t i;
=20
+ /* no cmdline needed for type 'none' */
+ if (def->nvideos > 0 &&
+ def->videos[0]->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_NONE)
+ return 0;
+
for (i =3D 0; i < def->nvideos; i++) {
char *str =3D NULL;
virDomainVideoDefPtr video =3D def->videos[i];
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ed76495309..af8c5f8b0b 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4471,6 +4471,9 @@ static int
qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video)
{
switch ((virDomainVideoType) video->type) {
+ case VIR_DOMAIN_VIDEO_TYPE_NONE:
+ /* nothing to be validated for 'none' */
+ return 0;
case VIR_DOMAIN_VIDEO_TYPE_XEN:
case VIR_DOMAIN_VIDEO_TYPE_VBOX:
case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 6ea80616af..e045b2627e 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -799,6 +799,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic=
eDefPtr dev,
=20
case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
case VIR_DOMAIN_VIDEO_TYPE_GOP:
+ case VIR_DOMAIN_VIDEO_TYPE_NONE:
case VIR_DOMAIN_VIDEO_TYPE_LAST:
return 0;
}
@@ -1518,6 +1519,13 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPt=
r def,
* at slot 2.
*/
virDomainVideoDefPtr primaryVideo =3D def->videos[0];
+
+ /* for video type 'none' skip this whole procedure */
+ if (primaryVideo->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_NONE) {
+ ret =3D 0;
+ goto cleanup;
+ }
+
if (virDeviceInfoPCIAddressWanted(&primaryVideo->info)) {
memset(&tmp_addr, 0, sizeof(tmp_addr));
tmp_addr.slot =3D 2;
@@ -2083,6 +2091,8 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
=20
/* Video devices */
for (i =3D 0; i < def->nvideos; i++) {
+ if (def->videos[i]->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_NONE)
+ break;
=20
if (!virDeviceInfoPCIAddressWanted(&def->videos[i]->info))
continue;
diff --git a/tests/domaincapsschemadata/full.xml b/tests/domaincapsschemada=
ta/full.xml
index d3faf38da0..474df90283 100644
--- a/tests/domaincapsschemadata/full.xml
+++ b/tests/domaincapsschemadata/full.xml
@@ -73,6 +73,7 @@
parallelsvirtiogop
+ none
diff --git a/tests/qemuxml2argvdata/video-invalid-multiple-devices.xml b/te=
sts/qemuxml2argvdata/video-invalid-multiple-devices.xml
new file mode 100644
index 0000000000..3f105efaae
--- /dev/null
+++ b/tests/qemuxml2argvdata/video-invalid-multiple-devices.xml
@@ -0,0 +1,33 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219100
+ 219100
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/video-none-device.args b/tests/qemuxml2=
argvdata/video-none-device.args
new file mode 100644
index 0000000000..1b03c0cb97
--- /dev/null
+++ b/tests/qemuxml2argvdata/video-none-device.args
@@ -0,0 +1,27 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+QEMU_AUDIO_DRV=3Dnone \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \
+-m 214 \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni=
tor.sock,\
+server,nowait \
+-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \
+-rtc base=3Dutc \
+-no-shutdown \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide=
0-0-0 \
+-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-=
0 \
+-vnc 127.0.0.1:0 \
+-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3
diff --git a/tests/qemuxml2argvdata/video-none-device.xml b/tests/qemuxml2a=
rgvdata/video-none-device.xml
new file mode 100644
index 0000000000..4b591562b7
--- /dev/null
+++ b/tests/qemuxml2argvdata/video-none-device.xml
@@ -0,0 +1,39 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a929e4314e..af6d61bd16 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1973,7 +1973,9 @@ mymain(void)
QEMU_CAPS_DEVICE_VIRTIO_VGA,
QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS);
- DO_TEST_PARSE_ERROR("video-invalid", NONE);
+ DO_TEST("video-none-device",
+ QEMU_CAPS_VNC);
+ DO_TEST_PARSE_ERROR("video-invalid-multiple-devices", NONE);
=20
DO_TEST("virtio-rng-default",
QEMU_CAPS_DEVICE_VIRTIO_RNG,
diff --git a/tests/qemuxml2xmloutdata/video-none-device.xml b/tests/qemuxml=
2xmloutdata/video-none-device.xml
new file mode 100644
index 0000000000..6e76b394fe
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/video-none-device.xml
@@ -0,0 +1,42 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index c0b228515c..fa24a0f4eb 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1140,6 +1140,7 @@ mymain(void)
QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS,
QEMU_CAPS_VNC,
QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW);
+ DO_TEST("video-none-device", NONE);
=20
DO_TEST("intel-iommu",
QEMU_CAPS_DEVICE_INTEL_IOMMU);
--=20
2.14.4
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list