[PATCH 10/19] qemu: use virDomainDefHasGraphics

marcandre.lureau@redhat.com posted 19 patches 7 months, 1 week ago
There is a newer version of this series
[PATCH 10/19] qemu: use virDomainDefHasGraphics
Posted by marcandre.lureau@redhat.com 7 months, 1 week ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 src/qemu/qemu_validate.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 54226b8c62..c5b66c4966 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -4409,8 +4409,6 @@ qemuValidateDomainDeviceDefGraphics(const virDomainGraphicsDef *graphics,
                                     virQEMUCaps *qemuCaps)
 {
     virDomainCapsDeviceGraphics graphicsCaps = { 0 };
-    bool have_egl_headless = false;
-    size_t i;
 
     virQEMUCapsFillDomainDeviceGraphicsCaps(qemuCaps, &graphicsCaps);
 
@@ -4421,18 +4419,11 @@ qemuValidateDomainDeviceDefGraphics(const virDomainGraphicsDef *graphics,
         return -1;
     }
 
-    for (i = 0; i < def->ngraphics; i++) {
-        if (def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS) {
-            have_egl_headless = true;
-            break;
-        }
-    }
-
     /* Only VNC and SPICE can be paired with egl-headless, the other types
      * either don't make sense to pair with egl-headless or aren't even
      * supported by QEMU.
      */
-    if (have_egl_headless) {
+    if (virDomainDefHasGraphics(def, VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS)) {
         if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS &&
             graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
             graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
-- 
2.47.0
Re: [PATCH 10/19] qemu: use virDomainDefHasGraphics
Posted by Daniel P. Berrangé 6 months, 4 weeks ago
On Wed, Jan 29, 2025 at 05:40:32PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  src/qemu/qemu_validate.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|