mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
qemu-nbd: Add --bitmap=NAME option
Having to fire up qemu, then use QMP commands for nbd-server-start and nbd-server-add, just to expose a persistent dirty bitmap, is rather tedious. Make it possible to expose a dirty bitmap using just qemu-nbd (of course, for now this only works when qemu-nbd is visiting a BDS formatted as qcow2). Of course, any good feature also needs unit testing, so expand iotest 223 to cover it. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20190111194720.15671-9-eblake@redhat.com>
This commit is contained in:
parent
678ba275c7
commit
636192c4b6
4 changed files with 40 additions and 4 deletions
|
@ -25,6 +25,7 @@ status=1 # failure is the default!
|
|||
|
||||
_cleanup()
|
||||
{
|
||||
nbd_server_stop
|
||||
_cleanup_test_img
|
||||
_cleanup_qemu
|
||||
rm -f "$TEST_DIR/nbd"
|
||||
|
@ -35,6 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
|
|||
. ./common.rc
|
||||
. ./common.filter
|
||||
. ./common.qemu
|
||||
. ./common.nbd
|
||||
|
||||
_supported_fmt qcow2
|
||||
_supported_proto file # uses NBD as well
|
||||
|
@ -163,7 +165,7 @@ $QEMU_IMG map --output=json --image-opts \
|
|||
"$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b2" | _filter_qemu_img_map
|
||||
|
||||
echo
|
||||
echo "=== End NBD server ==="
|
||||
echo "=== End qemu NBD server ==="
|
||||
echo
|
||||
|
||||
_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-remove",
|
||||
|
@ -176,6 +178,20 @@ _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-stop"}' "return"
|
|||
_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-stop"}' "error" # Again
|
||||
_send_qemu_cmd $QEMU_HANDLE '{"execute":"quit"}' "return"
|
||||
|
||||
echo
|
||||
echo "=== Use qemu-nbd as server ==="
|
||||
echo
|
||||
|
||||
nbd_server_start_unix_socket -r -f $IMGFMT -B b "$TEST_IMG"
|
||||
IMG="driver=nbd,server.type=unix,server.path=$nbd_unix_socket"
|
||||
$QEMU_IMG map --output=json --image-opts \
|
||||
"$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b" | _filter_qemu_img_map
|
||||
|
||||
nbd_server_start_unix_socket -f $IMGFMT -B b2 "$TEST_IMG"
|
||||
IMG="driver=nbd,server.type=unix,server.path=$nbd_unix_socket"
|
||||
$QEMU_IMG map --output=json --image-opts \
|
||||
"$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b2" | _filter_qemu_img_map
|
||||
|
||||
# success, all done
|
||||
echo '*** done'
|
||||
rm -f $seq.full
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue