[PATCH 3/3] Manually kill gzip if restore fails before starting qemu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If a guest image is saved in compressed format, and the restore fails
in some way after the intermediate process used to uncompress the
image has been started, but before qemu has been started to hook up to
the uncompressor, libvirt will endlessly wait for the uncompressor to
finish, but it never will because it's still waiting to have something
hooked up to drain its output.

The solution is to manually send a SIGTERM to the compressor process
before calling waitpid on it (only if the restore has failed, of
course).
---
 src/qemu/qemu_driver.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 985b062..cdf7964 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5764,6 +5764,12 @@ qemudDomainSaveImageStartVM(virConnectPtr conn,
                              VIR_VM_OP_RESTORE);
 
     if (intermediate_pid != -1) {
+        /* if there was an error setting up qemu, the intermediate process will
+         * wait forever to write to stdout, so we must manually kill it
+         */
+        if (ret < 0)
+            kill(intermediate_pid, SIGTERM);
+
         /* Wait for intermediate process to exit */
         while (waitpid(intermediate_pid, &childstat, 0) == -1 &&
                errno == EINTR) {
-- 
1.7.3.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]