From 088ff08ce9f0338949316d853548902fabbdc9af Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 7 Jan 2014 14:31:13 +0100 Subject: [PATCH] qemuProcessStop: Don't overwrite any errors Currently, the qemuProcessStop tries to open the domain log file and saves the original error afterwards. Then all the cleanup is done after which the error is restored back. This has however one flaw: if opening of the log file fails an error is reported, which results in previous error being overwritten (the useful one, e.g. "PCI device XXXX:XXXX could not be found"). Hence, user sees something like: error: failed to create logfile /var/log/libvirt/qemu/ovirt_usb.log: No such file or directory instead of: error: internal error: Did not find USB device 8644:8003 Signed-off-by: Michal Privoznik Reported-by: Zhou Yimin --- src/qemu/qemu_process.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d0fde5495b..9331744fd5 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4224,6 +4224,10 @@ void qemuProcessStop(virQEMUDriverPtr driver, return; } + /* This method is routinely used in clean up paths. Disable error + * reporting so we don't squash a legit error. */ + orig_err = virSaveLastError(); + /* * We may unlock the vm in qemuProcessKill(), and another thread * can lock the vm, and then call qemuProcessStop(). So we should @@ -4256,10 +4260,6 @@ void qemuProcessStop(virQEMUDriverPtr driver, virStrerror(errno, ebuf, sizeof(ebuf))); } - /* This method is routinely used in clean up paths. Disable error - * reporting so we don't squash a legit error. */ - orig_err = virSaveLastError(); - virDomainConfVMNWFilterTeardown(vm); if (cfg->macFilter) {