[libvirt] [PATCH 3/3]: Read cmd stdout + stderr in virRun
Daniel P. Berrange
berrange at redhat.com
Tue Nov 4 22:48:17 UTC 2008
On Mon, Nov 03, 2008 at 02:54:23PM -0500, Cole Robinson wrote:
> Daniel P. Berrange wrote:
> > On Thu, Oct 30, 2008 at 02:06:35PM -0400, Cole Robinson wrote:
> >
> >> The attached patch is my second cut at reading
> >> stdout and stderr of the command virRun kicks
> >> off. There is no hard limit to the amount of
> >> data we read now, and we use a poll loop to
> >> avoid any possible full buffer issues.
> >>
> >> If stdout or stderr had any content, we DEBUG
> >> it, and if the command appears to fail we
> >> return stderr in the error message. So now,
> >> trying to stop a logical pool with active
> >> volumes will return:
> >>
> >> $ sudo virsh pool-destroy vgdata
> >> libvir: error : internal error '/sbin/vgchange -an vgdata' exited with non-zero status 5 and signal 0: Can't deactivate volume group "vgdata" with 2 open logical volume(s)
> >> error: Failed to destroy pool vgdata
> >>
>
> <snip>
>
> > I think it'd be nice to move the I/O processing loop out of the
> > virRun() function and into a separate helper functiion along the
> > lines of
> >
> > virPipeReadUntilEOF(int outfd, int errfd, char **outbuf, char **errbuf)
> >
> > Daniel
> >
>
>
> Okay, updated patch attached. Also addresses the point Jim
> raised about poll.h
ACK, this version looks good to me.
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list