From: Peter Krempa <pkrempa@redhat.com>
Preserve the error on cleanup path as cleanup of the 'libivrt_iohelper'
process may overwrite it with an unactionable error, such as when
attempting to restore a save image while the VM is already running:
$ virsh list
Id Name State
--------------------------
9 cd running
$ virsh restore /tmp/cd.save
error: Failed to restore domain from /tmp/cd.save
error: internal error: Child process (LIBVIRT_LOG_OUTPUTS=1:stderr /home/pipo/build/libvirt/gcc/src/libvirt_iohelper /tmp/cd.save 0) unexpected fatal signal 13
After this patch the original error is reported:
$ virsh restore /tmp/cd.save
error: Failed to restore domain from /tmp/cd.save
error: Requested operation is not valid: domain 'cd' is already active
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
src/qemu/qemu_driver.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 61d95bfbbf..25ba6695bb 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5985,6 +5985,7 @@ qemuDomainRestoreInternal(virQEMUDriver *driver,
bool sparse = false;
bool bypass_cache = (flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0;
g_autoptr(qemuMigrationParams) restoreParams = NULL;
+ virErrorPtr save_err = NULL;
virCheckFlags(QEMU_DOMAIN_RESTORE_FLAGS, -1);
@@ -6109,6 +6110,7 @@ qemuDomainRestoreInternal(virQEMUDriver *driver,
qemuProcessEndJob(vmNew);
cleanup:
+ virErrorPreserveLast(&save_err);
VIR_FORCE_CLOSE(fd);
if (virFileWrapperFdClose(wrapperFd) < 0)
ret = -1;
@@ -6117,6 +6119,7 @@ qemuDomainRestoreInternal(virQEMUDriver *driver,
if (vmNew && ret < 0)
qemuDomainRemoveInactive(vmNew, 0, false);
virDomainObjEndAPI(&vmNew);
+ virErrorRestore(&save_err);
return ret;
}
--
2.55.0
On Tue, Aug 18, 2026 at 05:16:33PM +0200, Peter Krempa via Devel wrote: > From: Peter Krempa <pkrempa@redhat.com> > > Preserve the error on cleanup path as cleanup of the 'libivrt_iohelper' s/libivrt_iohelper/libvirt_iohelper/ > process may overwrite it with an unactionable error, such as when > attempting to restore a save image while the VM is already running: > > $ virsh list > Id Name State > -------------------------- > 9 cd running > > $ virsh restore /tmp/cd.save > error: Failed to restore domain from /tmp/cd.save > error: internal error: Child process (LIBVIRT_LOG_OUTPUTS=1:stderr /home/pipo/build/libvirt/gcc/src/libvirt_iohelper /tmp/cd.save 0) unexpected fatal signal 13 > > After this patch the original error is reported: > > $ virsh restore /tmp/cd.save > error: Failed to restore domain from /tmp/cd.save > error: Requested operation is not valid: domain 'cd' is already active > > Signed-off-by: Peter Krempa <pkrempa@redhat.com> > --- > src/qemu/qemu_driver.c | 3 +++ > 1 file changed, 3 insertions(+) Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
On Tue, Aug 18, 2026 at 05:16:33PM +0200, Peter Krempa via Devel wrote: >From: Peter Krempa <pkrempa@redhat.com> > >Preserve the error on cleanup path as cleanup of the 'libivrt_iohelper' >process may overwrite it with an unactionable error, such as when >attempting to restore a save image while the VM is already running: > > $ virsh list > Id Name State > -------------------------- > 9 cd running > > $ virsh restore /tmp/cd.save > error: Failed to restore domain from /tmp/cd.save > error: internal error: Child process (LIBVIRT_LOG_OUTPUTS=1:stderr /home/pipo/build/libvirt/gcc/src/libvirt_iohelper /tmp/cd.save 0) unexpected fatal signal 13 > >After this patch the original error is reported: > > $ virsh restore /tmp/cd.save > error: Failed to restore domain from /tmp/cd.save > error: Requested operation is not valid: domain 'cd' is already active > >Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com> >--- > src/qemu/qemu_driver.c | 3 +++ > 1 file changed, 3 insertions(+) > >diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c >index 61d95bfbbf..25ba6695bb 100644 >--- a/src/qemu/qemu_driver.c >+++ b/src/qemu/qemu_driver.c >@@ -5985,6 +5985,7 @@ qemuDomainRestoreInternal(virQEMUDriver *driver, > bool sparse = false; > bool bypass_cache = (flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0; > g_autoptr(qemuMigrationParams) restoreParams = NULL; >+ virErrorPtr save_err = NULL; > > virCheckFlags(QEMU_DOMAIN_RESTORE_FLAGS, -1); > >@@ -6109,6 +6110,7 @@ qemuDomainRestoreInternal(virQEMUDriver *driver, > qemuProcessEndJob(vmNew); > > cleanup: >+ virErrorPreserveLast(&save_err); > VIR_FORCE_CLOSE(fd); > if (virFileWrapperFdClose(wrapperFd) < 0) > ret = -1; >@@ -6117,6 +6119,7 @@ qemuDomainRestoreInternal(virQEMUDriver *driver, > if (vmNew && ret < 0) > qemuDomainRemoveInactive(vmNew, 0, false); > virDomainObjEndAPI(&vmNew); >+ virErrorRestore(&save_err); > return ret; > } > >-- >2.55.0 >
© 2016 - 2026 Red Hat, Inc.