Move EGL Headless validation from qemuBuildGraphicsEGLHeadlessCommandLine()
to qemuDomainDeviceDefValidateGraphics(). This function is called by
qemuDomainDefValidate(), validating the graphics parameters in domain
define time.
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_command.c | 10 +---------
src/qemu/qemu_domain.c | 8 ++++++++
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3267b0d4b5..b3f069d5d4 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7733,7 +7733,6 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
static int
qemuBuildGraphicsEGLHeadlessCommandLine(virQEMUDriverConfigPtr cfg G_GNUC_UNUSED,
virCommandPtr cmd,
- virQEMUCapsPtr qemuCaps,
virDomainGraphicsDefPtr graphics)
{
g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
@@ -7741,13 +7740,6 @@ qemuBuildGraphicsEGLHeadlessCommandLine(virQEMUDriverConfigPtr cfg
G_GNUC_UNUSED
virBufferAddLit(&opt, "egl-headless");
if (graphics->data.egl_headless.rendernode) {
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_EGL_HEADLESS_RENDERNODE)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("This QEMU doesn't support OpenGL rendernode
"
- "with egl-headless graphics type"));
- return -1;
- }
-
virBufferAddLit(&opt, ",rendernode=");
virQEMUBuildBufferEscapeComma(&opt,
graphics->data.egl_headless.rendernode);
@@ -7792,7 +7784,7 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg,
break;
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
if (qemuBuildGraphicsEGLHeadlessCommandLine(cfg, cmd,
- qemuCaps, graphics) < 0)
+ graphics) < 0)
return -1;
break;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 83964db595..fe353e5bc1 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -7941,6 +7941,14 @@ qemuDomainDeviceDefValidateGraphics(const virDomainGraphicsDef
*graphics,
break;
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
+ if (graphics->data.egl_headless.rendernode &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_EGL_HEADLESS_RENDERNODE)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("This QEMU doesn't support OpenGL rendernode
"
+ "with egl-headless graphics type"));
+ return -1;
+ }
+
break;
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
--
2.23.0