On 12/9/19 6:15 PM, Daniel Henrique Barboza wrote:
Move EGL Headless validation from
qemuBuildGraphicsEGLHeadlessCommandLine()
to qemuDomainDeviceDefValidateGraphics(). This function is called by
qemuDomainDefValidate(), validating the graphics parameters in domain
define time.
Tests were adapted to consider validation in this earlier stage.
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_command.c | 10 +---------
src/qemu/qemu_domain.c | 7 +++++++
tests/qemuxml2argvdata/graphics-egl-headless.args | 2 +-
.../qemuxml2argvdata/graphics-spice-egl-headless.args | 2 +-
tests/qemuxml2argvdata/graphics-vnc-egl-headless.args | 2 +-
tests/qemuxml2argvtest.c | 9 ++++++---
tests/qemuxml2xmltest.c | 6 ++++--
7 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index aceb42a289..efc70d6de9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7729,7 +7729,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;
@@ -7737,13 +7736,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);
@@ -7788,7 +7780,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 9f29d2afbe..415f0916a2 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -7717,6 +7717,13 @@ qemuDomainDeviceDefValidateGraphics(const virDomainGraphicsDef
*graphics,
break;
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
+ 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;
+ }
+
This looks like it is missing the associated check for
graphics->data.egl_headless.rendernode, like the original check had. I
wouldn't expect the test .args output later to change
- Cole