[libvirt] [PATCH 3/3]: Read cmd stdout + stderr in virRun

Cole Robinson crobinso at redhat.com
Mon Nov 3 19:54:23 UTC 2008

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


> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirt-virRun-logging-03.patch
Type: text/x-diff
Size: 5331 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20081103/c38bc035/attachment-0001.bin>

More information about the libvir-list mailing list