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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cole Robinson <crobinso@xxxxxxxxxx> 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
>
> Thanks,
> Cole
>
> commit af7d94392bc89fd0645514cd13a2186ca5224dfc
> Author: Cole Robinson <crobinso@xxxxxxxxxx>
> Date:   Thu Oct 30 13:46:06 2008 -0400
>
>     Capture command stdout and stderr in virRun
>
> diff --git a/src/util.c b/src/util.c
> index e59e25c..8d624b2 100644
> --- a/src/util.c
> +++ b/src/util.c
> @@ -33,6 +33,9 @@
>  #include <errno.h>
>  #include <sys/types.h>
>  #include <sys/stat.h>
> +#if HAVE_SYS_POLL_H
> +#include <sys/poll.h>
> +#endif

Hi Cole,
This looks fine to me.
One minor suggestion:

You can replace the above 3 lines with just

#include <poll.h>

<poll.h> is POSIX-specified, and guaranteed to be usable,
since we're now using gnulib's "poll" module.

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]