[ovirt-devel] execCmd() and storing stdout and stderr in log file

Yaniv Bronheim ybronhei at redhat.com
Wed Jul 6 15:37:54 UTC 2016


On Wed, Jul 6, 2016 at 5:07 PM, Tomáš Golembiovský <tgolembi at redhat.com>
wrote:

> On Tue, 5 Jul 2016 11:18:58 +0300
> Yaniv Bronheim <ybronhei at redhat.com> wrote:
>
> > On Tue, Jul 5, 2016 at 10:44 AM, Yaniv Bronheim <ybronhei at redhat.com>
> wrote:
> >
> > > Hi
> > > I do work to remove the cpopen usages from execCmd. Using std popen
> over
> > > py3 and subprocess32 over py2 which both implements the same api. The
> only
> > > gap is the output object for async calls that we need to align with the
> > > standard implementation and modify our current usages. I don't think
> that
> > > adding more non-standard logics to execCmd is a good idea. we should
> fit
> > > the standard usage in this function or override it separately with
> specific
> > > implementation in commands.py. You may propose such patch
>
> Sure, that makes sense. Are there any existing drafts/patches I could
> look at or help with?
>
no..

>
> Merging stdout and stderr to one can POpen do for us, I belive. Any

logging can indeed be done as a wrapper around execCmd.
>
> saving stdout and err to log while the process is running is useful only
for your purpose currently. using asyncproc as you do now in v2v allows you
to to run a process and monitor it.. can you use overriding of aysncProc
wrapper for your needs instead of changing cpopen or execcmd code?


>
> > [...]
> >
> > btw, after examine the area again, isn't watchCmd func is what you
> >  describe? we just need to replace the asyncProc usages there with
> > something that doesn't use StringIO as we do to support py3
>
> I'm not sure how watchCmd can help with this. Isn't it just a wrapper to
> get asynchrounous process with a stop condition?
>

it is. thought you need something similar and afterwards log the outputs

>
> Could you elaborate on why we want to get rid of StringIO in AsyncProc?
>
it uses StringIO.read and it is not supported in py3. we need to change the
implementation to support six.StringIO


> If I understand it right, it's purpose is to make sure the executed
> program doesn't stall on full pipe if VDSM isn't fast enough in
> processing the output. Or am I missing something? But it could again be
> implemented as a wrapper around execCmd and not in it. Is that what you
> mean?
>
>
> --
> Tomáš Golembiovský <tgolembi at redhat.com>
> _______________________________________________
> Devel mailing list
> Devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/devel
>



-- 
*Yaniv Bronhaim.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/devel/attachments/20160706/849b5eb7/attachment-0001.html>


More information about the Devel mailing list