qemuProcessQMPStop: Preserve error when killing qemu used for capability probing

When probing of capabilities fails 'qemuProcessQMPStop' kills the qemu
process, but also resets the error. The virResetLastError() was
originally intended to reset the error from 'virProcessKillPainfully',
it also resets any probing error resulting in the following:

  $ virsh start VM
  error: Failed to start domain 'VM'
  error: An error occurred, but the cause is unknown

Keep the error clearing as this might be called on success but preserve
the original error around it.

Fixes: db7b0b12b7
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa committed 2026-06-24 08:34:02 +02:00
1 parent 57a6e9773e
commit 5c351c8965
1 file changed
+4
+4
View File
@@ -10239,6 +10239,8 @@ static qemuMonitorCallbacks callbacks = {
static void
qemuProcessQMPStop(qemuProcessQMP *proc)
{
virErrorPtr err;
if (proc->mon) {
virObjectUnlock(proc->mon);
g_clear_pointer(&proc->mon, qemuMonitorClose);
@@ -10255,10 +10257,12 @@ qemuProcessQMPStop(qemuProcessQMP *proc)
virDomainObjEndAPI(&proc->vm);
if (proc->pid != 0) {
virErrorPreserveLast(&err);
VIR_DEBUG("Killing QMP caps process %lld", (long long)proc->pid);
virProcessKillPainfully(proc->pid, true);
virResetLastError();
proc->pid = 0;
virErrorRestore(&err);
}
if (proc->pidfile)