From nobody Mon May 13 02:52:28 2024
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 153010650613292.52348284896107;
Wed, 27 Jun 2018 06:35:06 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com
[10.5.11.23])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 7106A3084038;
Wed, 27 Jun 2018 13:35:02 +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 B08732B3A1;
Wed, 27 Jun 2018 13:35:01 +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 A28CA18037F0;
Wed, 27 Jun 2018 13:34:59 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w5RDYubU001347 for ;
Wed, 27 Jun 2018 09:34:57 -0400
Received: by smtp.corp.redhat.com (Postfix)
id C69D52026D6C; Wed, 27 Jun 2018 13:34:56 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id 4D8F92026D5B;
Wed, 27 Jun 2018 13:34:56 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Wed, 27 Jun 2018 15:34:38 +0200
Message-Id:
<83afe12b779ec2ea1162dc3e5181097092529762.1530106440.git.eskultet@redhat.com>
In-Reply-To:
References:
In-Reply-To:
References:
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-loop: libvir-list@redhat.com
Cc: Erik Skultety
Subject: [libvirt] [PATCH v1 01/11] conf: Remove a redundant
model/address-type check in mdev post parse
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.23
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]);
Wed, 27 Jun 2018 13:35:05 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
Content-Type: text/plain; charset="utf-8"
It's pointless to check the same thing multiple times.
Fix the indentation along the way too.
Signed-off-by: Erik Skultety
Reviewed-by: John Ferlan
---
src/conf/domain_conf.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d8cb7f37f3..d887df2c3e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4523,20 +4523,10 @@ virDomainHostdevDefPostParse(virDomainHostdevDefPtr=
dev,
if (dev->info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
return 0;
=20
- if (model =3D=3D VIR_MDEV_MODEL_TYPE_VFIO_PCI &&
- dev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
- virReportError(VIR_ERR_XML_ERROR,
- _("Unsupported address type '%s' with mediated "
- "device model '%s'"),
- virDomainDeviceAddressTypeToString(dev->info->t=
ype),
- virMediatedDeviceModelTypeToString(model));
- return -1;
- }
-
if ((model =3D=3D VIR_MDEV_MODEL_TYPE_VFIO_PCI &&
- dev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) ||
+ dev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) ||
(model =3D=3D VIR_MDEV_MODEL_TYPE_VFIO_CCW &&
- dev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)) {
+ dev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)) {
virReportError(VIR_ERR_XML_ERROR,
_("Unsupported address type '%s' with mediated "
"device model '%s'"),
--=20
2.14.4
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Mon May 13 02:52:28 2024
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 153010653246638.57859946610802;
Wed, 27 Jun 2018 06:35:32 -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 4AAD730820DB;
Wed, 27 Jun 2018 13:35:27 +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 C14A6308BDCE;
Wed, 27 Jun 2018 13:35:25 +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 1D24E18037F8;
Wed, 27 Jun 2018 13:35:25 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w5RDYvc0001356 for ;
Wed, 27 Jun 2018 09:34:57 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 8A0BB2026D6C; Wed, 27 Jun 2018 13:34:57 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id 10F642026D5B;
Wed, 27 Jun 2018 13:34:56 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Wed, 27 Jun 2018 15:34:39 +0200
Message-Id:
In-Reply-To:
References:
In-Reply-To:
References:
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-loop: libvir-list@redhat.com
Cc: Erik Skultety
Subject: [libvirt] [PATCH v1 02/11] qemu: command: Move graphics iteration
to its own function
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.47]);
Wed, 27 Jun 2018 13:35:30 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
Content-Type: text/plain; charset="utf-8"
It should be the command line helper who takes care of the iteration
rather than the caller.
Signed-off-by: Erik Skultety
Reviewed-by: John Ferlan
---
src/qemu/qemu_command.c | 57 +++++++++++++++++++++++++++++++--------------=
----
1 file changed, 36 insertions(+), 21 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4fc3176ad3..78c18440e5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8141,26 +8141,44 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConf=
igPtr cfg,
static int
qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg,
virCommandPtr cmd,
- virQEMUCapsPtr qemuCaps,
- virDomainGraphicsDefPtr graphics)
+ virDomainDefPtr def,
+ virQEMUCapsPtr qemuCaps)
{
- switch (graphics->type) {
- case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
- return qemuBuildGraphicsSDLCommandLine(cfg, cmd, qemuCaps, graphic=
s);
+ size_t i;
=20
- case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
- return qemuBuildGraphicsVNCCommandLine(cfg, cmd, qemuCaps, graphic=
s);
+ for (i =3D 0; i < def->ngraphics; i++) {
+ virDomainGraphicsDefPtr graphics =3D def->graphics[i];
=20
- case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
- return qemuBuildGraphicsSPICECommandLine(cfg, cmd, qemuCaps, graph=
ics);
+ switch (graphics->type) {
+ case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
+ if (qemuBuildGraphicsSDLCommandLine(cfg, cmd,
+ qemuCaps, graphics) < 0)
+ return -1;
=20
- case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
- case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
- case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unsupported graphics type '%s'"),
- virDomainGraphicsTypeToString(graphics->type));
- return -1;
+ break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
+ if (qemuBuildGraphicsVNCCommandLine(cfg, cmd,
+ qemuCaps, graphics) < 0)
+ return -1;
+
+ break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
+ if (qemuBuildGraphicsSPICECommandLine(cfg, cmd,
+ qemuCaps, graphics) < 0)
+ return -1;
+
+ break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unsupported graphics type '%s'"),
+ virDomainGraphicsTypeToString(graphics->type));
+ return -1;
+ case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
+ default:
+ virReportEnumRangeError(virDomainGraphicsType, graphics->type);
+ return -1;
+ }
}
=20
return 0;
@@ -10299,11 +10317,8 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
if (qemuBuildInputCommandLine(cmd, def, qemuCaps) < 0)
goto error;
=20
- for (i =3D 0; i < def->ngraphics; ++i) {
- if (qemuBuildGraphicsCommandLine(cfg, cmd, qemuCaps,
- def->graphics[i]) < 0)
- goto error;
- }
+ if (qemuBuildGraphicsCommandLine(cfg, cmd, def, qemuCaps) < 0)
+ goto error;
=20
if (qemuBuildVideoCommandLine(cmd, def, qemuCaps) < 0)
goto error;
--=20
2.14.4
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Mon May 13 02:52:28 2024
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 1530106526138186.37773901449032;
Wed, 27 Jun 2018 06:35:26 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id C68B33002716;
Wed, 27 Jun 2018 13:35:22 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C5C67F5DE;
Wed, 27 Jun 2018 13:35:22 +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 DD8883FCC0;
Wed, 27 Jun 2018 13:35:21 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w5RDYwLN001379 for ;
Wed, 27 Jun 2018 09:34:58 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 526F720180EB; Wed, 27 Jun 2018 13:34:58 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id CDA8A2026D5B;
Wed, 27 Jun 2018 13:34:57 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Wed, 27 Jun 2018 15:34:40 +0200
Message-Id:
<21a0e781bf102b8f43d001f61dd821c6cdad0901.1530106440.git.eskultet@redhat.com>
In-Reply-To:
References:
In-Reply-To:
References:
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-loop: libvir-list@redhat.com
Cc: Erik Skultety
Subject: [libvirt] [PATCH v1 03/11] qemu: command: Add
virReportEnumRangeError to BuildHostdevCommandline
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.79 on 10.5.11.12
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]);
Wed, 27 Jun 2018 13:35:25 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
Content-Type: text/plain; charset="utf-8"
Adding the 'default' case to our enum-typecasted switches is the current
safety trend, so add it here for mdevs too.
Signed-off-by: Erik Skultety
Reviewed-by: John Ferlan
---
src/qemu/qemu_command.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 78c18440e5..1e5d7f9ccf 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5397,10 +5397,10 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
}
break;
case VIR_MDEV_MODEL_TYPE_LAST:
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected vfio type '%d'"), subsys->u.m=
dev.model);
+ default:
+ virReportEnumRangeError(virMediatedDeviceModelType,
+ subsys->u.mdev.model);
return -1;
- break;
}
=20
virCommandAddArg(cmd, "-device");
--=20
2.14.4
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Mon May 13 02:52:28 2024
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 1530106534083556.8650355588944;
Wed, 27 Jun 2018 06:35:34 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 05447356F8;
Wed, 27 Jun 2018 13:35:31 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 714D17F5CA;
Wed, 27 Jun 2018 13:35:29 +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 BBCE83FC9D;
Wed, 27 Jun 2018 13:35:28 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w5RDYxIT001426 for ;
Wed, 27 Jun 2018 09:34:59 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 140DA2026D6C; Wed, 27 Jun 2018 13:34:59 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id 8F0272026D5B;
Wed, 27 Jun 2018 13:34:58 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Wed, 27 Jun 2018 15:34:41 +0200
Message-Id:
In-Reply-To:
References:
In-Reply-To:
References:
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-loop: libvir-list@redhat.com
Cc: Erik Skultety
Subject: [libvirt] [PATCH v1 04/11] conf: Replace error label with cleanup
in virDomainGraphicsDefParseVNCXML
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.79 on 10.5.11.12
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]);
Wed, 27 Jun 2018 13:35:33 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
Content-Type: text/plain; charset="utf-8"
Signed-off-by: Erik Skultety
Reviewed-by: John Ferlan
---
src/conf/domain_conf.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d887df2c3e..09d9bac739 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13568,13 +13568,13 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphics=
DefPtr def,
int ret =3D -1;
=20
if (virDomainGraphicsListensParseXML(def, node, ctxt, flags) < 0)
- goto error;
+ goto cleanup;
=20
if (port) {
if (virStrToLong_i(port, NULL, 10, &def->data.vnc.port) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse vnc port %s"), port);
- goto error;
+ goto cleanup;
}
/* Legacy compat syntax, used -1 for auto-port */
if (def->data.vnc.port =3D=3D -1) {
@@ -13603,7 +13603,7 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDe=
fPtr def,
&def->data.vnc.websocket) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse vnc WebSocket port %s"), websoc=
ket);
- goto error;
+ goto cleanup;
}
}
=20
@@ -13615,7 +13615,7 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDe=
fPtr def,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown vnc display sharing policy '%s'"),
sharePolicy);
- goto error;
+ goto cleanup;
} else {
def->data.vnc.sharePolicy =3D policy;
}
@@ -13625,10 +13625,10 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphics=
DefPtr def,
=20
if (virDomainGraphicsAuthDefParseXML(node, &def->data.vnc.auth,
def->type) < 0)
- goto error;
+ goto cleanup;
=20
ret =3D 0;
- error:
+ cleanup:
VIR_FREE(port);
VIR_FREE(autoport);
VIR_FREE(websocket);
--=20
2.14.4
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Mon May 13 02:52:28 2024
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 1530106505422493.15188314341106;
Wed, 27 Jun 2018 06:35:05 -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 BA39D81DF7;
Wed, 27 Jun 2018 13:35:03 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D216308BDB9;
Wed, 27 Jun 2018 13:35:03 +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 66FCA4A463;
Wed, 27 Jun 2018 13:35:02 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w5RDYxb8001443 for ;
Wed, 27 Jun 2018 09:35:00 -0400
Received: by smtp.corp.redhat.com (Postfix)
id CB0662026D6C; Wed, 27 Jun 2018 13:34:59 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id 520D12026D5B;
Wed, 27 Jun 2018 13:34:59 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Wed, 27 Jun 2018 15:34:42 +0200
Message-Id:
In-Reply-To:
References:
In-Reply-To:
References:
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-loop: libvir-list@redhat.com
Cc: Erik Skultety
Subject: [libvirt] [PATCH v1 05/11] qemu: command: Fix building of the SDL
display command line
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.25]);
Wed, 27 Jun 2018 13:35:04 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
Content-Type: text/plain; charset="utf-8"
QEMU uses a shorthand '-sdl' which maps to '-display sdl'. However, if
there are any options to be passed to SDL, the full command version must
be used. Everything seemingly worked for us until commit 5038b300437
introduced OpenGL support for SDL and added ',gl=3Don/off' option which as
mentioned above could have never worked with the shorthand version of
the command. Indeed starting a domain with an SDL display and OpenGL
enabled, QEMU produces a rather cryptic error:
-sdl: Could not open 'gl=3Don': No such file or directory
This patch provides fixes to both the SDL cmdline generation and the
test suite.
Signed-off-by: Erik Skultety
Reviewed-by: John Ferlan
---
src/qemu/qemu_command.c | 19 +++++++++++------=
--
tests/qemuxml2argvdata/graphics-sdl-fullscreen.args | 2 +-
tests/qemuxml2argvdata/graphics-sdl.args | 2 +-
tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.args | 2 +-
4 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1e5d7f9ccf..195d03e373 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7722,7 +7722,6 @@ qemuBuildGraphicsSDLCommandLine(virQEMUDriverConfigPt=
r cfg ATTRIBUTE_UNUSED,
{
int ret =3D -1;
virBuffer opt =3D VIR_BUFFER_INITIALIZER;
- const char *optContent;
=20
if (graphics->data.sdl.xauth)
virCommandAddEnvPair(cmd, "XAUTHORITY", graphics->data.sdl.xauth);
@@ -7738,22 +7737,26 @@ qemuBuildGraphicsSDLCommandLine(virQEMUDriverConfig=
Ptr cfg ATTRIBUTE_UNUSED,
virCommandAddEnvPassBlockSUID(cmd, "QEMU_AUDIO_DRV", NULL);
virCommandAddEnvPassBlockSUID(cmd, "SDL_AUDIODRIVER", NULL);
=20
- virCommandAddArg(cmd, "-sdl");
+ virCommandAddArg(cmd, "-display");
+ virBufferAddLit(&opt, "sdl");
=20
- if (graphics->data.sdl.gl =3D=3D VIR_TRISTATE_BOOL_YES) {
+ if (graphics->data.sdl.gl !=3D VIR_TRISTATE_BOOL_ABSENT) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SDL_GL)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("This QEMU doesn't support SDL OpenGL"));
+ _("OpenGL for SDL is not supported with this QE=
MU "
+ "binary"));
goto cleanup;
}
=20
- virBufferAsprintf(&opt, "gl=3D%s",
+ virBufferAsprintf(&opt, ",gl=3D%s",
virTristateSwitchTypeToString(graphics->data.sdl=
.gl));
+
}
=20
- optContent =3D virBufferCurrentContent(&opt);
- if (optContent && STRNEQ(optContent, ""))
- virCommandAddArgBuffer(cmd, &opt);
+ if (virBufferCheckError(&opt) < 0)
+ goto cleanup;
+
+ virCommandAddArgBuffer(cmd, &opt);
=20
ret =3D 0;
cleanup:
diff --git a/tests/qemuxml2argvdata/graphics-sdl-fullscreen.args b/tests/qe=
muxml2argvdata/graphics-sdl-fullscreen.args
index 2da9d1e327..0741baa039 100644
--- a/tests/qemuxml2argvdata/graphics-sdl-fullscreen.args
+++ b/tests/qemuxml2argvdata/graphics-sdl-fullscreen.args
@@ -25,5 +25,5 @@ server,nowait \
-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 \
-full-screen \
--sdl \
+-display sdl \
-vga cirrus
diff --git a/tests/qemuxml2argvdata/graphics-sdl.args b/tests/qemuxml2argvd=
ata/graphics-sdl.args
index 29a0a3d823..2553679738 100644
--- a/tests/qemuxml2argvdata/graphics-sdl.args
+++ b/tests/qemuxml2argvdata/graphics-sdl.args
@@ -24,5 +24,5 @@ server,nowait \
-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 \
--sdl \
+-display sdl \
-vga std
diff --git a/tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.args b/tests/qe=
muxml2argvdata/video-virtio-gpu-sdl-gl.args
index 4172320ede..f8610e53b0 100644
--- a/tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.args
+++ b/tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.args
@@ -23,6 +23,6 @@ server,nowait \
-drive file=3D/var/lib/libvirt/images/QEMUGuest1,format=3Dqcow2,if=3Dnone,\
id=3Ddrive-ide0-0-0,cache=3Dnone \
-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-=
0 \
--sdl gl=3Don \
+-display sdl,gl=3Don \
-device virtio-gpu-pci,id=3Dvideo0,virgl=3Don,bus=3Dpci.0,addr=3D0x2 \
-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3
--=20
2.14.4
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Mon May 13 02:52:28 2024
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 153010652463346.04050827393678;
Wed, 27 Jun 2018 06:35:24 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id BCD6A308404E;
Wed, 27 Jun 2018 13:35:22 +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 557777F5CF;
Wed, 27 Jun 2018 13:35:22 +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 C544518037F4;
Wed, 27 Jun 2018 13:35:21 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w5RDZ0wK001463 for ;
Wed, 27 Jun 2018 09:35:00 -0400
Received: by smtp.corp.redhat.com (Postfix)
id B160D20180EB; Wed, 27 Jun 2018 13:35:00 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id 1AA2A2026D5B;
Wed, 27 Jun 2018 13:34:59 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Wed, 27 Jun 2018 15:34:43 +0200
Message-Id:
<772b0cc7736b72447fdd4b0d607e3213fe65d1d0.1530106440.git.eskultet@redhat.com>
In-Reply-To:
References:
In-Reply-To:
References:
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-loop: libvir-list@redhat.com
Cc: Erik Skultety
Subject: [libvirt] [PATCH v1 06/11] conf: Make graphics's GL a standalone
structure
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.79 on 10.5.11.12
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]);
Wed, 27 Jun 2018 13:35:24 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
Content-Type: text/plain; charset="utf-8"
Since we support gl with SPICE and SDL with future VNC enablement in
sight (egl-headless), let's separate the gl-related attributes into a
standalone structure.
Signed-off-by: Erik Skultety
Reviewed-by: John Ferlan
---
src/conf/domain_conf.c | 137 +++++++++++++++++++++++++---------------=
----
src/conf/domain_conf.h | 12 +++-
src/qemu/qemu_cgroup.c | 10 ++--
src/qemu/qemu_command.c | 66 ++++++++++++---------
src/qemu/qemu_domain.c | 7 ++-
src/security/security_dac.c | 7 ++-
6 files changed, 138 insertions(+), 101 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 09d9bac739..6bfa3ca130 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1420,8 +1420,6 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr=
def)
break;
=20
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
- VIR_FREE(def->data.spice.rendernode);
- VIR_FREE(def->data.spice.keymap);
virDomainGraphicsAuthDefClear(&def->data.spice.auth);
break;
=20
@@ -1429,6 +1427,8 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr=
def)
break;
}
=20
+ virDomainGraphicsGLDefFree(def->gl);
+
for (i =3D 0; i < def->nListens; i++)
virDomainGraphicsListenDefClear(&def->listens[i]);
VIR_FREE(def->listens);
@@ -1436,6 +1436,18 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPt=
r def)
VIR_FREE(def);
}
=20
+
+void
+virDomainGraphicsGLDefFree(virDomainGraphicsGLDefPtr def)
+{
+ if (!def)
+ return;
+
+ VIR_FREE(def->rendernode);
+ VIR_FREE(def);
+}
+
+
const char *virDomainInputDefGetPath(virDomainInputDefPtr input)
{
switch ((virDomainInputType) input->type) {
@@ -13555,6 +13567,48 @@ virDomainGraphicsListensParseXML(virDomainGraphics=
DefPtr def,
}
=20
=20
+static int
+virDomainGraphicsGLDefParseXML(virDomainGraphicsDefPtr def,
+ xmlNodePtr node)
+{
+ virDomainGraphicsGLDefPtr gl =3D NULL;
+ char *enable =3D NULL;
+ int ret =3D -1;
+
+ if (!node)
+ return 0;
+
+ if (VIR_ALLOC(gl) < 0)
+ return -1;
+
+ if (!(enable =3D virXMLPropString(node, "enable"))) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("'enable' attribute is mandatory for graphics "
+ " element"));
+ goto cleanup;
+ }
+
+ if ((gl->enable =3D
+ virTristateBoolTypeFromString(enable)) <=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown value for attribute enable '%s'"),
+ enable);
+ goto cleanup;
+ }
+
+ if (def->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE)
+ gl->rendernode =3D virXMLPropString(node, "rendernode");
+
+ VIR_STEAL_PTR(def->gl, gl);
+
+ ret =3D 0;
+ cleanup:
+ VIR_FREE(enable);
+ virDomainGraphicsGLDefFree(gl);
+ return ret;
+}
+
+
static int
virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDefPtr def,
xmlNodePtr node,
@@ -13644,8 +13698,6 @@ virDomainGraphicsDefParseXMLSDL(virDomainGraphicsDe=
fPtr def,
{
xmlNodePtr save =3D ctxt->node;
char *enable =3D NULL;
- int enableVal;
- xmlNodePtr glNode;
char *fullscreen =3D virXMLPropString(node, "fullscreen");
int ret =3D -1;
=20
@@ -13668,23 +13720,9 @@ virDomainGraphicsDefParseXMLSDL(virDomainGraphicsD=
efPtr def,
def->data.sdl.xauth =3D virXMLPropString(node, "xauth");
def->data.sdl.display =3D virXMLPropString(node, "display");
=20
- glNode =3D virXPathNode("./gl", ctxt);
- if (glNode) {
- enable =3D virXMLPropString(glNode, "enable");
- if (!enable) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("sdl gl element missing enable"));
- goto cleanup;
- }
-
- enableVal =3D virTristateBoolTypeFromString(enable);
- if (enableVal < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown enable value '%s'"), enable);
- goto cleanup;
- }
- def->data.sdl.gl =3D enableVal;
- }
+ if (virDomainGraphicsGLDefParseXML(def,
+ virXPathNode("./gl[1]", ctxt)) < 0)
+ goto cleanup;
=20
ret =3D 0;
cleanup:
@@ -14026,31 +14064,6 @@ virDomainGraphicsDefParseXMLSpice(virDomainGraphic=
sDefPtr def,
VIR_FREE(enable);
=20
def->data.spice.filetransfer =3D enableVal;
- } else if (virXMLNodeNameEqual(cur, "gl")) {
- char *enable =3D virXMLPropString(cur, "enable");
- char *rendernode =3D virXMLPropString(cur, "rendernode");
- int enableVal;
-
- if (!enable) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("spice gl element missing enable"));
- VIR_FREE(rendernode);
- goto error;
- }
-
- if ((enableVal =3D
- virTristateBoolTypeFromString(enable)) <=3D 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown enable value '%s'"), enable);
- VIR_FREE(enable);
- VIR_FREE(rendernode);
- goto error;
- }
- VIR_FREE(enable);
-
- def->data.spice.gl =3D enableVal;
- def->data.spice.rendernode =3D rendernode;
-
} else if (virXMLNodeNameEqual(cur, "mouse")) {
char *mode =3D virXMLPropString(cur, "mode");
int modeVal;
@@ -14071,6 +14084,9 @@ virDomainGraphicsDefParseXMLSpice(virDomainGraphics=
DefPtr def,
VIR_FREE(mode);
=20
def->data.spice.mousemode =3D modeVal;
+ } else if (virXMLNodeNameEqual(cur, "gl")) {
+ if (virDomainGraphicsGLDefParseXML(def, cur) < 0)
+ goto error;
}
}
cur =3D cur->next;
@@ -26148,18 +26164,25 @@ virDomainGraphicsListenDefFormatAddr(virBufferPtr=
buf,
virBufferAsprintf(buf, " listen=3D'%s'", glisten->address);
}
=20
+
static void
-virDomainSpiceGLDefFormat(virBufferPtr buf, virDomainGraphicsDefPtr def)
+virDomainGraphicsGLDefFormat(virBufferPtr buf, virDomainGraphicsDefPtr def)
{
- if (def->data.spice.gl =3D=3D VIR_TRISTATE_BOOL_ABSENT)
+ virDomainGraphicsGLDefPtr gl =3D def->gl;
+
+ if (!gl)
return;
=20
virBufferAsprintf(buf, "data.spice.gl));
- virBufferEscapeString(buf, " rendernode=3D'%s'", def->data.spice.rende=
rnode);
+ virTristateBoolTypeToString(gl->enable));
+
+ if (def->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE)
+ virBufferEscapeString(buf, " rendernode=3D'%s'", gl->rendernode);
+
virBufferAddLit(buf, "/>\n");
}
=20
+
static int
virDomainGraphicsDefFormat(virBufferPtr buf,
virDomainGraphicsDefPtr def,
@@ -26247,18 +26270,12 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
if (def->data.sdl.fullscreen)
virBufferAddLit(buf, " fullscreen=3D'yes'");
=20
- if (!children && def->data.sdl.gl !=3D VIR_TRISTATE_BOOL_ABSENT) {
+ if (!children && def->gl) {
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
children =3D true;
}
=20
- if (def->data.sdl.gl !=3D VIR_TRISTATE_BOOL_ABSENT) {
- virBufferAsprintf(buf, "data.sdl.gl=
));
- virBufferAddLit(buf, "/>\n");
- }
-
break;
=20
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
@@ -26405,8 +26422,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
if (!children && (def->data.spice.image || def->data.spice.jpeg ||
def->data.spice.zlib || def->data.spice.playback=
||
def->data.spice.streaming || def->data.spice.cop=
ypaste ||
- def->data.spice.mousemode || def->data.spice.fil=
etransfer ||
- def->data.spice.gl)) {
+ def->data.spice.mousemode || def->data.spice.fil=
etransfer)) {
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
children =3D true;
@@ -26436,9 +26452,10 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, "\n",
virTristateBoolTypeToString(def->data.spice.=
filetransfer));
=20
- virDomainSpiceGLDefFormat(buf, def);
}
=20
+ virDomainGraphicsGLDefFormat(buf, def);
+
if (children) {
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "\n");
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 0924fc4f3c..20dc1334c4 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1598,6 +1598,13 @@ struct _virDomainGraphicsListenDef {
bool autoGenerated;
};
=20
+typedef struct _virDomainGraphicsGLDef virDomainGraphicsGLDef;
+typedef virDomainGraphicsGLDef *virDomainGraphicsGLDefPtr;
+struct _virDomainGraphicsGLDef {
+ virTristateBool enable;
+ char *rendernode; /* SPICE only */
+};
+
struct _virDomainGraphicsDef {
/* Port value discipline:
* Value -1 is legacy syntax indicating that it should be auto-allocat=
ed.
@@ -1620,7 +1627,6 @@ struct _virDomainGraphicsDef {
char *display;
char *xauth;
bool fullscreen;
- virTristateBool gl;
} sdl;
struct {
int port;
@@ -1650,8 +1656,6 @@ struct _virDomainGraphicsDef {
int streaming;
virTristateBool copypaste;
virTristateBool filetransfer;
- virTristateBool gl;
- char *rendernode;
} spice;
} data;
/* nListens, listens, and *port are only useful if type is vnc,
@@ -1659,6 +1663,7 @@ struct _virDomainGraphicsDef {
* simplify parsing code.*/
size_t nListens;
virDomainGraphicsListenDefPtr listens;
+ virDomainGraphicsGLDefPtr gl;
};
=20
typedef enum {
@@ -2837,6 +2842,7 @@ int virDomainObjWaitUntil(virDomainObjPtr vm,
void virDomainPanicDefFree(virDomainPanicDefPtr panic);
void virDomainResourceDefFree(virDomainResourceDefPtr resource);
void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
+void virDomainGraphicsGLDefFree(virDomainGraphicsGLDefPtr def);
const char *virDomainInputDefGetPath(virDomainInputDefPtr input);
void virDomainInputDefFree(virDomainInputDefPtr def);
virDomainDiskDefPtr virDomainDiskDefNew(virDomainXMLOptionPtr xmlopt);
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index c8fba7f9e6..81e86fa973 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -489,20 +489,20 @@ qemuSetupGraphicsCgroup(virDomainObjPtr vm,
virDomainGraphicsDefPtr gfx)
{
qemuDomainObjPrivatePtr priv =3D vm->privateData;
- const char *rendernode =3D gfx->data.spice.rendernode;
int ret;
=20
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICE=
S))
return 0;
=20
if (gfx->type !=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE ||
- gfx->data.spice.gl !=3D VIR_TRISTATE_BOOL_YES ||
- !rendernode)
+ !gfx->gl ||
+ gfx->gl->enable !=3D VIR_TRISTATE_BOOL_YES ||
+ !gfx->gl->rendernode)
return 0;
=20
- ret =3D virCgroupAllowDevicePath(priv->cgroup, rendernode,
+ ret =3D virCgroupAllowDevicePath(priv->cgroup, gfx->gl->rendernode,
VIR_CGROUP_DEVICE_RW, false);
- virDomainAuditCgroupPath(vm, priv->cgroup, "allow", rendernode,
+ virDomainAuditCgroupPath(vm, priv->cgroup, "allow", gfx->gl->rendernod=
e,
"rw", ret);
return ret;
}
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 195d03e373..ef0be95b0f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7740,7 +7740,8 @@ qemuBuildGraphicsSDLCommandLine(virQEMUDriverConfigPt=
r cfg ATTRIBUTE_UNUSED,
virCommandAddArg(cmd, "-display");
virBufferAddLit(&opt, "sdl");
=20
- if (graphics->data.sdl.gl !=3D VIR_TRISTATE_BOOL_ABSENT) {
+ if (graphics->gl &&
+ graphics->gl->enable !=3D VIR_TRISTATE_BOOL_ABSENT) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SDL_GL)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("OpenGL for SDL is not supported with this QE=
MU "
@@ -7749,7 +7750,7 @@ qemuBuildGraphicsSDLCommandLine(virQEMUDriverConfigPt=
r cfg ATTRIBUTE_UNUSED,
}
=20
virBufferAsprintf(&opt, ",gl=3D%s",
- virTristateSwitchTypeToString(graphics->data.sdl=
.gl));
+ virTristateSwitchTypeToString(graphics->gl->enab=
le));
=20
}
=20
@@ -7886,6 +7887,35 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigP=
tr cfg,
}
=20
=20
+static int
+qemuBuildGraphicsSPICEGLCommandLine(virDomainGraphicsGLDefPtr gl,
+ virBufferPtr opt,
+ virQEMUCapsPtr qemuCaps)
+{
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_GL)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("This QEMU doesn't support spice OpenGL"));
+ return -1;
+ }
+
+ virBufferAddLit(opt, "gl=3Don,");
+
+ if (gl->rendernode) {
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_RENDERNODE)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("This QEMU doesn't support spice OpenGL rende=
rnode"));
+ return -1;
+ }
+
+ virBufferAddLit(opt, "rendernode=3D");
+ virQEMUBuildBufferEscapeComma(opt, gl->rendernode);
+ virBufferAddLit(opt, ",");
+ }
+
+ return 0;
+}
+
+
static int
qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
virCommandPtr cmd,
@@ -8089,31 +8119,6 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfi=
gPtr cfg,
}
}
=20
- if (graphics->data.spice.gl =3D=3D VIR_TRISTATE_BOOL_YES) {
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_GL)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("This QEMU doesn't support spice OpenGL"));
- goto error;
- }
-
- /* spice.gl is a TristateBool, but qemu expects on/off: use
- * TristateSwitch helper */
- virBufferAsprintf(&opt, "gl=3D%s,",
- virTristateSwitchTypeToString(graphics->data.spi=
ce.gl));
-
- if (graphics->data.spice.rendernode) {
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_RENDERNODE)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("This QEMU doesn't support spice OpenGL r=
endernode"));
- goto error;
- }
-
- virBufferAddLit(&opt, "rendernode=3D");
- virQEMUBuildBufferEscapeComma(&opt, graphics->data.spice.rende=
rnode);
- virBufferAddLit(&opt, ",");
- }
- }
-
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEAMLESS_MIGRATION)) {
/* If qemu supports seamless migration turn it
* unconditionally on. If migration destination
@@ -8122,10 +8127,17 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConf=
igPtr cfg,
virBufferAddLit(&opt, "seamless-migration=3Don,");
}
=20
+ /* OpenGL magic */
+ if (graphics->gl &&
+ graphics->gl->enable =3D=3D VIR_TRISTATE_BOOL_YES &&
+ qemuBuildGraphicsSPICEGLCommandLine(graphics->gl, &opt, qemuCaps) =
< 0)
+ goto error;
+
virBufferTrim(&opt, ",", -1);
=20
virCommandAddArg(cmd, "-spice");
virCommandAddArgBuffer(cmd, &opt);
+
if (graphics->data.spice.keymap)
virCommandAddArgList(cmd, "-k",
graphics->data.spice.keymap, NULL);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index f8a662f747..948b9b7fd0 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11290,11 +11290,12 @@ qemuDomainSetupGraphics(virQEMUDriverConfigPtr cf=
g ATTRIBUTE_UNUSED,
virDomainGraphicsDefPtr gfx,
const struct qemuDomainCreateDeviceData *data)
{
- const char *rendernode =3D gfx->data.spice.rendernode;
+ const char *rendernode =3D NULL;
=20
if (gfx->type !=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE ||
- gfx->data.spice.gl !=3D VIR_TRISTATE_BOOL_YES ||
- !rendernode)
+ !gfx->gl ||
+ gfx->gl->enable !=3D VIR_TRISTATE_BOOL_YES ||
+ !gfx->gl->rendernode)
return 0;
=20
return qemuDomainCreateDevice(rendernode, data, false);
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 4b623dcf39..e8757f04e8 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -1431,10 +1431,11 @@ virSecurityDACSetGraphicsLabel(virSecurityManagerPt=
r mgr,
return -1;
=20
if (gfx->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
- gfx->data.spice.gl =3D=3D VIR_TRISTATE_BOOL_YES &&
- gfx->data.spice.rendernode) {
+ gfx->gl &&
+ gfx->gl->enable =3D=3D VIR_TRISTATE_BOOL_YES &&
+ gfx->gl->rendernode) {
if (virSecurityDACSetOwnership(priv, NULL,
- gfx->data.spice.rendernode,
+ gfx->gl->rendernode,
user, group) < 0)
return -1;
}
--=20
2.14.4
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Mon May 13 02:52:28 2024
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 1530106533178589.7384674362042;
Wed, 27 Jun 2018 06:35:33 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 142BA308404F;
Wed, 27 Jun 2018 13:35:30 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 806E1855B8;
Wed, 27 Jun 2018 13:35:29 +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 E67C93FB1D;
Wed, 27 Jun 2018 13:35:28 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w5RDZ18j001475 for ;
Wed, 27 Jun 2018 09:35:02 -0400
Received: by smtp.corp.redhat.com (Postfix)
id BA75D20180EB; Wed, 27 Jun 2018 13:35:01 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id 40F442026D5B;
Wed, 27 Jun 2018 13:35:00 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Wed, 27 Jun 2018 15:34:44 +0200
Message-Id:
<83d898f74d805ae2a2a6a152dce89f31b33c3798.1530106440.git.eskultet@redhat.com>
In-Reply-To:
References:
In-Reply-To:
References:
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-loop: libvir-list@redhat.com
Cc: Erik Skultety
Subject: [libvirt] [PATCH v1 07/11] conf: Allow usage of the element
with VNC graphics
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.79 on 10.5.11.13
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]);
Wed, 27 Jun 2018 13:35:32 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
Content-Type: text/plain; charset="utf-8"
VNC doesn't support OpenGL natively, but can run with non-native
egl-headless support, so enable that.
Signed-off-by: Erik Skultety
---
docs/formatdomain.html.in | 6 ++++
docs/schemas/domaincommon.rng | 7 ++++
src/conf/domain_conf.c | 8 +++++
src/qemu/qemu_command.c | 7 ++++
tests/qemuxml2argvdata/graphics-vnc-gl-invalid.xml | 37 ++++++++++++++++++=
++++
tests/qemuxml2argvdata/graphics-vnc-gl.args | 28 ++++++++++++++++
tests/qemuxml2argvdata/graphics-vnc-gl.xml | 37 ++++++++++++++++++=
++++
tests/qemuxml2argvtest.c | 1 +
8 files changed, 131 insertions(+)
create mode 100644 tests/qemuxml2argvdata/graphics-vnc-gl-invalid.xml
create mode 100644 tests/qemuxml2argvdata/graphics-vnc-gl.args
create mode 100644 tests/qemuxml2argvdata/graphics-vnc-gl.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0d68596991..aa0d6b26df 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6350,6 +6350,12 @@ qemu-kvm -net nic,model=3D? /dev/null
auto-allocation and autoport having no effect d=
ue to
security reasons) Since 1.0.6.
+
+ Since 4.6.0 it's possible to us=
e the
+ gl element with enable=3D'yes' to =
enable
+ OpenGL support using QEMU's egl-headless display, since VNC
+ doesn't support OpenGL natively like SPICE does.
+
spiceSince 0.8.6<=
/dt>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index f46145cf9b..20649c5f6f 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3135,6 +3135,13 @@
+
+
+
+
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6bfa3ca130..2ccd9e124f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13619,8 +13619,11 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsD=
efPtr def,
char *websocket =3D virXMLPropString(node, "websocket");
char *sharePolicy =3D virXMLPropString(node, "sharePolicy");
char *autoport =3D virXMLPropString(node, "autoport");
+ xmlNodePtr save =3D ctxt->node;
int ret =3D -1;
=20
+ ctxt->node =3D node;
+
if (virDomainGraphicsListensParseXML(def, node, ctxt, flags) < 0)
goto cleanup;
=20
@@ -13681,12 +13684,17 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphics=
DefPtr def,
def->type) < 0)
goto cleanup;
=20
+ if (virDomainGraphicsGLDefParseXML(def,
+ virXPathNode("./gl[1]", ctxt)) < 0)
+ goto cleanup;
+
ret =3D 0;
cleanup:
VIR_FREE(port);
VIR_FREE(autoport);
VIR_FREE(websocket);
VIR_FREE(sharePolicy);
+ ctxt->node =3D save;
return ret;
}
=20
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ef0be95b0f..89a8408df6 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7879,6 +7879,13 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigP=
tr cfg,
else
virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=3Dnone");
=20
+ /* OpenGL support */
+ if (graphics->gl &&
+ graphics->gl->enable =3D=3D VIR_TRISTATE_BOOL_YES) {
+ virCommandAddArg(cmd, "-display");
+ virCommandAddArg(cmd, "egl-headless");
+ }
+
return 0;
=20
error:
diff --git a/tests/qemuxml2argvdata/graphics-vnc-gl-invalid.xml b/tests/qem=
uxml2argvdata/graphics-vnc-gl-invalid.xml
new file mode 100644
index 0000000000..0f34791046
--- /dev/null
+++ b/tests/qemuxml2argvdata/graphics-vnc-gl-invalid.xml
@@ -0,0 +1,37 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219100
+ 219100
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/graphics-vnc-gl.args b/tests/qemuxml2ar=
gvdata/graphics-vnc-gl.args
new file mode 100644
index 0000000000..2d2b3cf0fb
--- /dev/null
+++ b/tests/qemuxml2argvdata/graphics-vnc-gl.args
@@ -0,0 +1,28 @@
+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 '[2001:1:2:3:4:5:1234:1234]:3' \
+-display egl-headless \
+-vga cirrus
diff --git a/tests/qemuxml2argvdata/graphics-vnc-gl.xml b/tests/qemuxml2arg=
vdata/graphics-vnc-gl.xml
new file mode 100644
index 0000000000..fea2caf843
--- /dev/null
+++ b/tests/qemuxml2argvdata/graphics-vnc-gl.xml
@@ -0,0 +1,37 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219100
+ 219100
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index c279ac4975..c310349b57 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1187,6 +1187,7 @@ mymain(void)
DO_TEST("graphics-vnc-none", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VG=
A);
DO_TEST("graphics-vnc-socket-new-cmdline", QEMU_CAPS_VNC,
QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_VNC_MULTI_SERVERS);
+ DO_TEST("graphics-vnc-gl", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
=20
driver.config->vncSASL =3D 1;
VIR_FREE(driver.config->vncSASLdir);
--=20
2.14.4
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Mon May 13 02:52:28 2024
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 15301065388981020.301075080865;
Wed, 27 Jun 2018 06:35:38 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com
[10.5.11.25])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id A887730BF569;
Wed, 27 Jun 2018 13:35:36 +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 537942010D76;
Wed, 27 Jun 2018 13:35:36 +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 F238018037F1;
Wed, 27 Jun 2018 13:35:35 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w5RDZ5P1001547 for ;
Wed, 27 Jun 2018 09:35:05 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 86B6A20180EB; Wed, 27 Jun 2018 13:35:05 +0000 (UTC)
Received: from beluga.usersys.redhat.com (unknown [10.43.2.166])
by smtp.corp.redhat.com (Postfix) with ESMTP id A65D92026D5B;
Wed, 27 Jun 2018 13:35:01 +0000 (UTC)
From: Erik Skultety
To: libvir-list@redhat.com
Date: Wed, 27 Jun 2018 15:34:45 +0200
Message-Id:
In-Reply-To:
References:
In-Reply-To:
References:
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-loop: libvir-list@redhat.com
Cc: Erik Skultety
Subject: [libvirt] [PATCH v1 08/11] conf: Introduce new attribute
'native' for SPICE
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.25
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]);
Wed, 27 Jun 2018 13:35:38 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
Content-Type: text/plain; charset="utf-8"
Since QEMU 2.10, there's a new cmdline option '-display egl-headless'
which enables OpenGL support for cases where we can't render on a local
display (i.e. is set to either 'address' or 'network').
This is to work around the current restriction on the local node with
native OpenGL SPICE support. However, compared to native support,
egl-headless has overhead, because the rendered framebuffer has to be
copied back to QEMU's display area which is then accessed by either
SPICE or VNC and sent to the remote side.
This patch enables this configuration feature by introducing a new
SPICE-only attribute 'native' which helps libvirt to determine whether
to use '-spice gl=3Don' or '-display egl-headless' on the cmdline. If the
attribute wasn't specified but OpenGL is to be enabled, then given the
nature of the element, libvirt will determine the default
value.
Signed-off-by: Erik Skultety
---
docs/formatdomain.html.in | 8 ++++
docs/schemas/domaincommon.rng | 16 +++++--
src/conf/domain_conf.c | 49 ++++++++++++++++++=
++--
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 43 ++++++++++++-------
.../qemuxml2argvdata/graphics-spice-gl-native.args | 26 ++++++++++++
.../qemuxml2argvdata/graphics-spice-gl-native.xml | 25 +++++++++++
.../graphics-spice-gl-non-native.args | 27 ++++++++++++
.../graphics-spice-gl-non-native.xml | 24 +++++++++++
tests/qemuxml2argvtest.c | 8 ++++
.../video-virtio-gpu-spice-gl.xml | 2 +-
11 files changed, 206 insertions(+), 23 deletions(-)
create mode 100644 tests/qemuxml2argvdata/graphics-spice-gl-native.args
create mode 100644 tests/qemuxml2argvdata/graphics-spice-gl-native.xml
create mode 100644 tests/qemuxml2argvdata/graphics-spice-gl-non-native.args
create mode 100644 tests/qemuxml2argvdata/graphics-spice-gl-non-native.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index aa0d6b26df..c6ebd39bd9 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6461,6 +6461,14 @@ qemu-kvm -net nic,model=3D? /dev/null
You can enable or disable OpenGL support explicitly with
the gl element, by setting the enable
property. (QEMU only, since 1.3.3).
+ Additionally, attribute native
+ (Since 4.6.0) can be used to sp=
ecify
+ whether native OpenGL support should be used with SPICE or
+ egl-headless should be used instead. Note that the native Op=
enGL
+ support is only limited to the local setup (listen is
+ either 'none' or 'socket') and for remote access egl-headless
+ needs to be used. The supported values for this attribute ar=
e 'on'
+ and 'off'.
By default, QEMU will pick the first available GPU DRM rende=
r node.
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 20649c5f6f..4ad53d976b 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3066,6 +3066,11 @@
+
+
+
+
+
@@ -3322,9 +3327,14 @@
-
-
-
+
+
+
+
+
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2ccd9e124f..6d399a198e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4280,6 +4280,7 @@ virDomainDefPostParseGraphics(virDomainDef *def)
* same. */
if (graphics->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
virDomainGraphicsListenDefPtr glisten =3D &graphics->listens[0=
];
+ virDomainGraphicsGLDefPtr gl =3D graphics->gl;
=20
if (glisten->type =3D=3D VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRE=
SS &&
graphics->data.spice.port =3D=3D 0 &&
@@ -4288,6 +4289,28 @@ virDomainDefPostParseGraphics(virDomainDef *def)
VIR_FREE(glisten->address);
glisten->type =3D VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE;
}
+
+ /* Next we need to figure out how to properly configure the Op=
enGL
+ * if that is enabled and the 'native' attribute is missing.
+ * The cases are:
+ * 1) Listen type is either 'socket' or 'none' - SPICE na=
tive
+ * OpenGL support (,gl=3Don) should be used because we're
+ * rendering on a local display.
+ *
+ * 2) Listen is either network or address - SPICE can't u=
se
+ * the native OpenGL support remotely yet, so we use
+ * native=3D'no' and format '-display egl-headless' onto =
the
+ * cmdline.
+ */
+ if (graphics->gl &&
+ graphics->gl->enable =3D=3D VIR_TRISTATE_BOOL_YES &&
+ graphics->gl->native =3D=3D VIR_TRISTATE_BOOL_ABSENT) {
+ gl->native =3D VIR_TRISTATE_BOOL_NO;
+
+ if (glisten->type =3D=3D VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_N=
ONE ||
+ glisten->type =3D=3D VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_S=
OCKET)
+ gl->native =3D VIR_TRISTATE_BOOL_YES;
+ }
}
}
}
@@ -13573,6 +13596,7 @@ virDomainGraphicsGLDefParseXML(virDomainGraphicsDef=
Ptr def,
{
virDomainGraphicsGLDefPtr gl =3D NULL;
char *enable =3D NULL;
+ char *native =3D NULL;
int ret =3D -1;
=20
if (!node)
@@ -13596,14 +13620,26 @@ virDomainGraphicsGLDefParseXML(virDomainGraphicsD=
efPtr def,
goto cleanup;
}
=20
- if (def->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE)
- gl->rendernode =3D virXMLPropString(node, "rendernode");
+ /* SPICE recognizes a few more attributes */
+ if (def->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
+ gl->rendernode =3D virXMLPropString(node, "rendernode");
+
+ native =3D virXMLPropString(node, "native");
+ if (native &&
+ (gl->native =3D virTristateBoolTypeFromString(native)) <=3D 0)=
{
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown value for attribute enable '%s'"),
+ enable);
+ goto cleanup;
+ }
+ }
=20
VIR_STEAL_PTR(def->gl, gl);
=20
ret =3D 0;
cleanup:
VIR_FREE(enable);
+ VIR_FREE(native);
virDomainGraphicsGLDefFree(gl);
return ret;
}
@@ -26184,8 +26220,13 @@ virDomainGraphicsGLDefFormat(virBufferPtr buf, vir=
DomainGraphicsDefPtr def)
virBufferAsprintf(buf, "enable));
=20
- if (def->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE)
- virBufferEscapeString(buf, " rendernode=3D'%s'", gl->rendernode);
+ if (gl->enable =3D=3D VIR_TRISTATE_BOOL_YES) {
+ if (def->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
+ virBufferAsprintf(buf, " native=3D'%s'",
+ virTristateBoolTypeToString(gl->native));
+ virBufferEscapeString(buf, " rendernode=3D'%s'", gl->rendernod=
e);
+ }
+ }
=20
virBufferAddLit(buf, "/>\n");
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 20dc1334c4..99b5896391 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1602,6 +1602,7 @@ typedef struct _virDomainGraphicsGLDef virDomainGraph=
icsGLDef;
typedef virDomainGraphicsGLDef *virDomainGraphicsGLDefPtr;
struct _virDomainGraphicsGLDef {
virTristateBool enable;
+ virTristateBool native; /* -spice gl=3Don vs -display egl-headless for=
QEMU */
char *rendernode; /* SPICE only */
};
=20
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 89a8408df6..fc80a6c3a6 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7896,27 +7896,39 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfig=
Ptr cfg,
=20
static int
qemuBuildGraphicsSPICEGLCommandLine(virDomainGraphicsGLDefPtr gl,
+ virCommandPtr cmd,
virBufferPtr opt,
virQEMUCapsPtr qemuCaps)
{
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_GL)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("This QEMU doesn't support spice OpenGL"));
- return -1;
- }
-
- virBufferAddLit(opt, "gl=3Don,");
-
- if (gl->rendernode) {
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_RENDERNODE)) {
+ if (gl->native =3D=3D VIR_TRISTATE_BOOL_NO) {
+ /* For non-native OpenGL, we need to add egl-headless to the cmdli=
ne.
+ *
+ * NB: QEMU defaults to '-spice gl=3Doff', so we don't have to add=
that
+ * explicitly, especially since we're not testing for GL capability
+ * presence.
+ */
+ virCommandAddArg(cmd, "-display");
+ virCommandAddArg(cmd, "egl-headless");
+ } else {
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_GL)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("This QEMU doesn't support spice OpenGL rende=
rnode"));
+ _("This QEMU doesn't support spice OpenGL"));
return -1;
}
=20
- virBufferAddLit(opt, "rendernode=3D");
- virQEMUBuildBufferEscapeComma(opt, gl->rendernode);
- virBufferAddLit(opt, ",");
+ virBufferAddLit(opt, "gl=3Don,");
+
+ if (gl->rendernode) {
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_RENDERNODE)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("This QEMU doesn't support spice OpenGL r=
endernode"));
+ return -1;
+ }
+
+ virBufferAddLit(opt, "rendernode=3D");
+ virQEMUBuildBufferEscapeComma(opt, gl->rendernode);
+ virBufferAddLit(opt, ",");
+ }
}
=20
return 0;
@@ -8137,7 +8149,8 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfig=
Ptr cfg,
/* OpenGL magic */
if (graphics->gl &&
graphics->gl->enable =3D=3D VIR_TRISTATE_BOOL_YES &&
- qemuBuildGraphicsSPICEGLCommandLine(graphics->gl, &opt, qemuCaps) =
< 0)
+ qemuBuildGraphicsSPICEGLCommandLine(graphics->gl, cmd,
+ &opt, qemuCaps) < 0)
goto error;
=20
virBufferTrim(&opt, ",", -1);
diff --git a/tests/qemuxml2argvdata/graphics-spice-gl-native.args b/tests/q=
emuxml2argvdata/graphics-spice-gl-native.args
new file mode 100644
index 0000000000..70d6694022
--- /dev/null
+++ b/tests/qemuxml2argvdata/graphics-spice-gl-native.args
@@ -0,0 +1,26 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+QEMU_AUDIO_DRV=3Dspice \
+/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 \
+-spice port=3D0,gl=3Don,rendernode=3D/dev/dri/foo \
+-vga cirrus \
+-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3
diff --git a/tests/qemuxml2argvdata/graphics-spice-gl-native.xml b/tests/qe=
muxml2argvdata/graphics-spice-gl-native.xml
new file mode 100644
index 0000000000..abfe628a9c
--- /dev/null
+++ b/tests/qemuxml2argvdata/graphics-spice-gl-native.xml
@@ -0,0 +1,25 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/graphics-spice-gl-non-native.args b/tes=
ts/qemuxml2argvdata/graphics-spice-gl-non-native.args
new file mode 100644
index 0000000000..9833cd6c0f
--- /dev/null
+++ b/tests/qemuxml2argvdata/graphics-spice-gl-non-native.args
@@ -0,0 +1,27 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+QEMU_AUDIO_DRV=3Dspice \
+/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 \
+-display egl-headless \
+-spice port=3D0 \
+-vga cirrus \
+-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3
diff --git a/tests/qemuxml2argvdata/graphics-spice-gl-non-native.xml b/test=
s/qemuxml2argvdata/graphics-spice-gl-non-native.xml
new file mode 100644
index 0000000000..003f2406ac
--- /dev/null
+++ b/tests/qemuxml2argvdata/graphics-spice-gl-non-native.xml
@@ -0,0 +1,24 @@
+
+ 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 c310349b57..e82496d403 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1256,6 +1256,14 @@ mymain(void)
QEMU_CAPS_SPICE_UNIX,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
driver.config->spiceAutoUnixSocket =3D false;
+ DO_TEST("graphics-spice-gl-native",
+ QEMU_CAPS_SPICE,
+ QEMU_CAPS_SPICE_GL,
+ QEMU_CAPS_SPICE_RENDERNODE,
+ QEMU_CAPS_DEVICE_CIRRUS_VGA);
+ DO_TEST("graphics-spice-gl-non-native",
+ QEMU_CAPS_SPICE,
+ QEMU_CAPS_DEVICE_CIRRUS_VGA);
=20
DO_TEST("input-usbmouse", NONE);
DO_TEST("input-usbtablet", NONE);
diff --git a/tests/qemuxml2xmloutdata/video-virtio-gpu-spice-gl.xml b/tests=
/qemuxml2xmloutdata/video-virtio-gpu-spice-gl.xml
index 720d362230..578341e09b 100644
--- a/tests/qemuxml2xmloutdata/video-virtio-gpu-spice-gl.xml
+++ b/tests/qemuxml2xmloutdata/video-virtio-gpu-spice-gl.xml
@@ -31,7 +31,7 @@
-
+