Gerd Hoffmann <kraxel@xxxxxxxxxx> writes: > On Wed, Jun 09, 2021 at 12:02:40PM +0200, Thomas Huth wrote: >> Libvirt's "domcapabilities" command has a way to state whether >> certain graphic frontends are available in QEMU or not. Originally, >> libvirt looked at the "--help" output of the QEMU binary to determine >> whether SDL was available or not (by looking for the "-sdl" parameter >> in the help text), but since libvirt stopped doing this analysis of >> the help text, the detection of SDL is currently broken, see: >> >> https://bugzilla.redhat.com/show_bug.cgi?id=1790902 >> >> QEMU should provide a way via the QMP interface instead. The simplest >> way, without introducing additional commands, is to make the DisplayType >> enum entries conditional, so that the enum only contains the entries if >> the corresponding CONFIG_xxx switches have been set. > > Hmm, that'll break for the "dnf remove qemu-ui-sdl" case ... By design, query-qmp-schema reflects compile-time configuration. It predates modules, and has not been updated for modules. For stuff that cannot be built as module, yes means yes in query-qmp-schema. For stuff that can be built as module, yes means maybe: yes if built-in or the module is loadable, else no. Modules are not quite transparent there. Transparency is a design goal, but I'm afraid it's an unattainable one. Parsing -help output would have the same issue. The only way to upgrade a maybe to a yes is to load the module. As long as module loading is implicit (because transparency!), the only way to load the module is to try using the feature, and recognize "can't load module" failures. "Just try and recognize failures" is workable in simple cases. In not so simple cases, it can be complex, slow and fragile (if it wasn't, introspection likely would not exist; see my "QEMU interface introspection: From hacks to solutions" talk at KVM Forum 2015).