提交 c9c794b5 编写于 作者: L Laine Stump

Manually kill gzip if restore fails before starting qemu

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 close the pipes on both sides of the uncompressor,
then send a SIGTERM before calling waitpid on it (only if the restore
has failed, of course).
上级 3493f1bc
......@@ -5770,6 +5770,15 @@ qemudDomainSaveImageStartVM(virConnectPtr conn,
VIR_VM_OP_RESTORE);
if (intermediate_pid != -1) {
if (ret < 0) {
/* if there was an error setting up qemu, the intermediate process will
* wait forever to write to stdout, so we must manually kill it.
*/
VIR_FORCE_CLOSE(intermediatefd);
VIR_FORCE_CLOSE(fd);
kill(intermediate_pid, SIGTERM);
}
/* Wait for intermediate process to exit */
while (waitpid(intermediate_pid, &childstat, 0) == -1 &&
errno == EINTR) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册