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