On Wed, Jan 26, 2011 at 09:00:14AM -0500, Laine Stump wrote: > On 01/26/2011 07:12 AM, Daniel P. Berrange wrote: > > > > I reckon closing the FD + SIGTERM is sufficient. GZip isn't > > sufficiently complicated that it will hang needing SIGKILL > > How about this? > > I do notice that these two fd's end up getting closed further down > anyway (even if we've failed, we still waitpid, close the > intermediatefd, then call qemudDomainSaveImageClose() to close fd. So > it's really a matter of timing - is it better to close the fd's > earlier and give gzip a chance to die a more natural death, or is it > okay to just give it one to the head, and clean up the fd's later? > > > --- > src/qemu/qemu_driver.c | 9 +++++++++ > 1 files changed, 9 insertions(+), 0 deletions(-) > > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c > index b6a5cd6..23e0db0 100644 > --- a/src/qemu/qemu_driver.c > +++ b/src/qemu/qemu_driver.c > @@ -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); > + } > + ACK Daniel -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list