[Libguestfs] [PATCH nbdkit v4 08/15] log: Log extents requests.
Eric Blake
eblake at redhat.com
Thu Mar 28 12:13:10 UTC 2019
On 3/26/19 4:17 PM, Richard W.M. Jones wrote:
> Typical output:
>
> 2019-03-26 18:22:17.287434 connection=2 Extents id=2 offset=0x0 count=0x40000000 req_one=1 ...
> 2019-03-26 18:22:17.290040 connection=2 ...Extents id=2 extents=[{ offset=0x0, length=0x250000, type=0 }, { offset=0x250000, length=0x7db0000, type=3 }, { offset=0x8000000, length=0x8000, type=0 }, { offset=0x8008000, length=0x38000, type=3 }, { offset=0x8040000, length=0x208000, type=0 }, { offset=0x8248000, length=0x7db8000, type=3 }, { offset=0x10000000, length=0x208000, type=0 }, { offset=0x10208000, length=0x7df8000, type=3 }, { offset=0x18000000, length=0x8000, type=0 }, { offset=0x18008000, length=0x38000, type=3 }, { offset=0x18040000, length=0x208000, type=0 }, { offset=0x18248000, length=0x7db8000, type=3 }, { offset=0x20000000, length=0x208000, type=0 }, { offset=0x20208000, length=0x7df8000, type=3 }, { offset=0x28000000, length=0x8000, type=0 }, { offset=0x28008000, length=0x38000, type=3 }, { offset=0x28040000, length=0x208000, type=0 }, { offset=0x28248000, length=0x7db8000, type=3 }, { offset=0x30000000, length=0x208000, type=0 }, { offset=0x30208000, length=0x7df8000, type=3 }, { offset=0x38000000, length=0x8000, type=0 }, { offset=0x38008000, length=0x38000, type=3 }, { offset=0x38040000, length=0x208000, type=0 }, { offset=0x38248000, length=0x7da8000, type=3 }, { offset=0x3fff0000, length=0x10000, type=0 }] return=0
>
> As you can see this is logging the complete information as generated
> by the underlying plugin, not what is returned to the client (which is
> rather hard for the log filter to discern). It's probably more useful
> for debugging like this.
Can get quite verbose, but that's par for a logger. If we wanted, we
could introduce a log-abbreviate option, to produce something like:
extents=[{ offset=0x0, length=0x250000, type=0 }, ...N more extents]
where you get verbose by default, but can opt-in to the shorter output.
> + else {
> + FILE *fp;
> + char *extents_str = NULL;
> + size_t i, n, len = 0;
> +
> + fp = open_memstream (&extents_str, &len);
Yeah, a memstream makes this easier (it is in POSIX, but not universally
available; do we care?)
Missing a patch to nbdkit-log-filter.pod:
> This filter writes to the file specified by the C<logfile=FILE>
> parameter. All lines include a timestamp, a connection counter, then
> details about the command. The following actions are logged: Connect,
> Read, Write, Zero, Trim, Flush, and Disconnect. Except for Connect
where that sentence needs to be updated.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20190328/375b0834/attachment.sig>
More information about the Libguestfs
mailing list