On 11/18/2010 02:55 AM, Daniel P. Berrange wrote:
On Wed, Nov 17, 2010 at 09:29:00PM -0700, Eric Blake wrote:
> From: Daniel P. Berrange <berrange(a)redhat.com>
>
> This introduces a new set of APIs in src/util/command.h
> to use for invoking commands. This is intended to replace
> all current usage of virRun and virExec variants, with a
> more flexible and less error prone API.
>
My code forgot to ever close() the fds in cmd->preserve. We definitely
need todo it in virCommandFree(), but there's a small argument to say
we should also do it in virCommandRun/virCommandRunAsync so that if
the caller keeps the virCommandPtr alive for a long time, we don't
have the open FDs.
I'll look into this more.
It would also be useful to have a generic API for logging info about
the command to an FD (to let us remove that logging code from UML
and QEMU & LXC drivers).
eg
+void virCommandWriteArgLog(virCommandPtr cmd, int logfd)
Would this be called before virCommandRun and do the logging immediately
at that point (or, if something has gone wrong such as allocation
failure, then nothing is logged, and the user will eventually learn that
nothing was logged when virCommandRun fails), or is it something where
you call it once to register the logfd, then calling virCommandRun is
what actually writes to the registered fd at the time the child is
actually spawned?
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org