On Tue, Feb 04, 2014 at 04:15:09PM +0100, Olaf Hering wrote:
On Tue, Feb 04, Richard W.M. Jones wrote:
> > It seems to me that output is only shown once cmd.sh has finished. I
> > already split cmd.sh into smaller pieces to see overall progress. But
> > output from a verbose, long running single command within cmd.sh is not
> > shown.
>
> Verbose output is carried over a separate channel from qemu, so things
> like kernel messages appear asynchronously:
>
>
https://github.com/libguestfs/libguestfs/blob/master/src/conn-socket.c#L301
Thanks.
I think doing 'cmd < /dev/null &> /dev/kmsg' will help, I will try
that
way to see whats actually going on.
It kinda works. It looks like /dev/kmsg itself is rather limited. It
returns -EINVAL if you try to write "too much" data, or if you read
from it "wrongly" or try to seek at all.
$ virt-builder fedora-20
[ 1.0] Downloading:
http://libguestfs.org/download/builder/fedora-20.xz
[ 2.0] Planning how to build this image
[ 2.0] Uncompressing
[ 12.0] Opening the new disk
[ 27.0] Setting a random seed
[ 27.0] Setting random root password [did you mean to use --root-password?]
Setting random password of root to ITqiAG1tvoFvt5X7
[ 27.0] Finishing off
Output: fedora-20.img
Output size: 4.0G
Output format: raw
Total usable space: 5.2G
Free space: 4.5G (86%)
$ guestfish -a fedora-20.img -i -v sh "yes test < /dev/null > /dev/kmsg
2>&1"
[...]
/bin/sh -c yes test < /dev/null > /dev/kmsg 2>&1
[ 1.813367] yes: standard output: Invalid argument
[ 1.813847] yes: write error
umount /sysroot/sys
umount /sysroot/proc
umount /sysroot/dev
guestfsd: error:
guestfsd: main_loop: proc 111 (sh) took 0.02 seconds
libguestfs: error: sh:
The order of the messages from guestfish indicates that the error from
'yes' was being logged to kernel messages and was being sent over the
verbose channel before the RPC returned.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/