<html><body>
<p>+1<br>
<br>
Code looks fine.<br>
I have not built or tested it. Please run cimtests before pushing.<br>
<br>
Regards,<br>
Sharad Mishra<br>
Open Virtualization<br>
Linux Technology Center<br>
IBM<br>
<br>
<tt>libvirt-cim-bounces@redhat.com wrote on 09/20/2011 03:33:54 PM:<br>
<br>
> Chip Vincent <cvincent@linux.vnet.ibm.com> </tt><br>
<tt>> Sent by: libvirt-cim-bounces@redhat.com<br>
> </tt><br>
<tt>> 09/20/2011 03:33 PM</tt><br>
<tt>> <br>
> Please respond to<br>
> List for discussion and development of libvirt CIM <libvirt-cim@redhat.com></tt><br>
<tt>> <br>
> To</tt><br>
<tt>> <br>
> libvirt-cim@redhat.com</tt><br>
<tt>> <br>
> cc</tt><br>
<tt>> <br>
> Subject</tt><br>
<tt>> <br>
> [Libvirt-cim] [PATCH] Redirect stdout & stderr when run as out-of-<br>
> process provider</tt><br>
<tt>> <br>
> # HG changeset patch<br>
> # User Chip Vincent <cvincent@us.ibm.com><br>
> # Date 1316557881 14400<br>
> # Node ID 4d95f2e9f2d8eac1565307def96bd158f5dcf160<br>
> # Parent  db809376d763493849c2a19f587969eaec619b75<br>
> Redirect stdout & stderr when run as out-of-process provider<br>
> <br>
> When a provider is loaded in-process by Pegasus, messages sent to<br>
> stdout and stderr are suppressed. However, when loaded out-of-process,<br>
> those same messages appear on the console. This happens excessively when<br>
> libvirt-cim LXC_ and XEN_ classes are enumerated and libvirt sends<br>
> "libvir: error : no connection driver available for..." messages to stderr.<br>
> In development, this can sometimes prevent console usage. Until a fix is<br>
> made to Pegasus, we'll suppress console output during provider initialization<br>
> when run in out-of-process mode.<br>
> <br>
> Signed-off-by: Chip Vincent <cvincent@us.ibm.com><br>
> <br>
> diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c<br>
> --- a/libxkutil/misc_util.c<br>
> +++ b/libxkutil/misc_util.c<br>
> @@ -29,6 +29,7 @@<br>
>  #include <stdarg.h><br>
>  #include <unistd.h><br>
>  #include <pthread.h><br>
> +#include <errno.h><br>
>  #include <libvirt/libvirt.h><br>
>  #include <libvirt/virterror.h><br>
>  <br>
> @@ -540,6 +541,17 @@<br>
>  {<br>
>          int ret = 0;<br>
>  <br>
> +        /* The tog-pegasus out-of-process provider feature does not<br>
> +        * redirect stdout and stderr, so it's done here to prevent<br>
> +        * any messages from taking over the console. One example is<br>
> +        * verbose connection failures sent to stdout by libvirt. */<br>
> +        if (strstr(program_invocation_short_name, "cimprovagt") != NULL) {<br>
> +                CU_DEBUG("Redirecting stdout and stderr");<br>
> +<br>
> +                stdout = freopen("/dev/null", "a", stdout);<br>
> +                stderr = freopen("/dev/null", "a", stderr);<br>
> +        }<br>
> +<br>
>          /* double-check lock pattern used for performance reasons */<br>
>          if (libvirt_initialized == 0) {<br>
>                  pthread_mutex_lock(&libvirt_mutex);<br>
> <br>
> _______________________________________________<br>
> Libvirt-cim mailing list<br>
> Libvirt-cim@redhat.com<br>
> <a href="https://www.redhat.com/mailman/listinfo/libvirt-cim">https://www.redhat.com/mailman/listinfo/libvirt-cim</a><br>
> <br>
</tt></body></html>