[Libguestfs] [PATCH nbdkit] tests: Convert some tests to use nbdsh instead of qemu-io.

Eric Blake eblake at redhat.com
Wed Sep 11 13:55:36 UTC 2019


On 9/11/19 5:40 AM, Richard W.M. Jones wrote:
> nbdsh has some advantages over qemu-io:
> 
>  - scriptable
> 
>  - allows us to more finely control NBD commands, such as
>    making subsector-sized requests and controlling how
>    many commands are sent on the wire
> 
>  - can write controlled patterns
> 
>  - can read NBD export flags

- can more easily get at exact errno response returned by server


>  # Because error rate is 0%, reads should never fail.
> -qemu-io -r -f raw "nbd+unix://?socket=$sock" \
> -        -c "r 0M 10M" \
> -        -c "r 20M 10M" \
> -        -c "r 40M 10M" \
> -        -c "r 60M 10M"
> +nbdsh --connect "nbd+unix://?socket=$sock" \
> +      -c 'mbytes = 2**20' \
> +      -c 'h.pread(10*mbytes, 0)' \
> +      -c 'h.pread(10*mbytes, 20*mbytes)' \
> +      -c 'h.pread(10*mbytes, 40*mbytes)' \
> +      -c 'h.pread(10*mbytes, 60*mbytes)'

A bit annoying that qemu-io and libnbd picked opposite ordering for
length vs. offset, but such is life.

LGTM.

-- 
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/20190911/33b9f811/attachment.sig>


More information about the Libguestfs mailing list