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

Cole Robinson crobinso at redhat.com
Wed Nov 5 18:59:54 UTC 2008


Daniel P. Berrange wrote:
> 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

Thanks, I've committed the series.

- Cole




More information about the libvir-list mailing list