]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virQEMUCapsLogProbeFailure: Reraise error with more information
authorPeter Krempa <pkrempa@redhat.com>
Thu, 18 Jun 2026 13:12:10 +0000 (15:12 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 24 Jun 2026 06:34:02 +0000 (08:34 +0200)
While we don't normally try to re-wrap errors to be more descriptive,
probing of qemu capabilities is a special case as the errors can be
cryptic and don't give users enough information about what's going on.
An example is (obtained from a patched qemu which accidentally returned
a broken QMP schema):

  $ virsh start VM
  error: Failed to start domain 'VM'
  error: internal error: Duplicate hash table key 'str'

The error is unusable. On the other hand in 'virQEMUCapsLogProbeFailure'
we do special logging of the caps probing failure with a custom UUID so
that it can be easily found in the logs which reports a much better
error message. Re-raise the same as a normal error too so that the user
gets similar experience:

  $ virsh start VM
  error: Failed to start domain 'VM'
  error: internal error: Failed to probe capabilities for /home/user/git/qemu.git/build/qemu-system-x86_64: internal error: Duplicate hash table key 'str'

This does mean though that the error is logged twice, once via the
custom log entry and second via 'virReportError'. Given that this error
is extremely unlikely, having two log entries IMO doesn't warant
reworking the whole error reporting infra to allow passing extra
metadata just for this one case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_capabilities.c

index a28f87ad2bd8d6e7b353d71afad6ea9de1c58fdf..be57dcad8e352f356dca88e1b7f339f42af67671 100644 (file)
@@ -6065,6 +6065,10 @@ virQEMUCapsLogProbeFailure(const char *binary)
                   meta,
                   _("Failed to probe capabilities for %1$s: %2$s"),
                   binary, virGetLastErrorMessage());
+
+    virReportError(VIR_ERR_INTERNAL_ERROR,
+                   _("Failed to probe capabilities for %1$s: %2$s"),
+                   binary, virGetLastErrorMessage());
 }