[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] block: nbd: Fix dirty bitmap context name
From: |
Nir Soffer |
Subject: |
[PATCH] block: nbd: Fix dirty bitmap context name |
Date: |
Thu, 19 Dec 2019 14:51:51 +0200 |
When adding an export with a dirty bitmap, expose the bitmap at:
qemu:dirty-bitmap:export-name
This matches qapi documentation, and user expectations.
Without this, qemu leaks libvirt implementations details to clients by
exposing the bitmap using the actual bitmap name:
qemu:dirty-bitmap:bitmap-name
And all clients need to duplicate code like:
meta_context = "qemu:dirty-bitmap:backup-" + export_name
NBD allows exposing multiple bitmaps under "qemu:dirty-bitmap:"
namespace, and clients can query the available bitmaps, but it is not
clear what a client should do if a server provides multiple bitmaps.
---
nbd/server.c | 2 +-
tests/qemu-iotests/223 | 16 ++++++++--------
tests/qemu-iotests/223.out | 8 ++++----
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/nbd/server.c b/nbd/server.c
index 24ebc1a805..f20f2994c0 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -1574,7 +1574,7 @@ NBDExport *nbd_export_new(BlockDriverState *bs, uint64_t
dev_offset,
exp->export_bitmap = bm;
assert(strlen(bitmap) <= BDRV_BITMAP_MAX_NAME_SIZE);
exp->export_bitmap_context = g_strdup_printf("qemu:dirty-bitmap:%s",
- bitmap);
+ name);
assert(strlen(exp->export_bitmap_context) < NBD_MAX_STRING_SIZE);
}
diff --git a/tests/qemu-iotests/223 b/tests/qemu-iotests/223
index ea69cd4b8b..3068a7c280 100755
--- a/tests/qemu-iotests/223
+++ b/tests/qemu-iotests/223
@@ -167,7 +167,7 @@ $QEMU_IO -r -c 'r -P 0x22 512 512' -c 'r -P 0 512k 512k' -c
'r -P 0x11 1m 1m' \
$QEMU_IMG map --output=json --image-opts \
"$IMG" | _filter_qemu_img_map
$QEMU_IMG map --output=json --image-opts \
- "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b" | _filter_qemu_img_map
+ "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:n" | _filter_qemu_img_map
echo
echo "=== Contrast to small granularity dirty-bitmap ==="
@@ -175,7 +175,7 @@ echo
IMG="driver=nbd,export=n2,server.type=unix,server.path=$SOCK_DIR/nbd"
$QEMU_IMG map --output=json --image-opts \
- "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b2" | _filter_qemu_img_map
+ "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:n2" | _filter_qemu_img_map
echo
echo "=== End qemu NBD server ==="
@@ -199,15 +199,15 @@ 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"
+nbd_server_start_unix_socket -r -f $IMGFMT -x n -B b "$TEST_IMG"
+IMG="driver=nbd,export=n,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
+ "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:n" | _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"
+nbd_server_start_unix_socket -f $IMGFMT -x n -B b2 "$TEST_IMG"
+IMG="driver=nbd,export=n,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
+ "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:n" | _filter_qemu_img_map
# success, all done
echo '*** done'
diff --git a/tests/qemu-iotests/223.out b/tests/qemu-iotests/223.out
index f175598802..9f879add60 100644
--- a/tests/qemu-iotests/223.out
+++ b/tests/qemu-iotests/223.out
@@ -61,7 +61,7 @@ exports available: 2
max block: 33554432
available meta contexts: 2
base:allocation
- qemu:dirty-bitmap:b
+ qemu:dirty-bitmap:n
export: 'n2'
size: 4194304
flags: 0xced ( flush fua trim zeroes df cache fast-zero )
@@ -70,7 +70,7 @@ exports available: 2
max block: 33554432
available meta contexts: 2
base:allocation
- qemu:dirty-bitmap:b2
+ qemu:dirty-bitmap:n2
=== Contrast normal status to large granularity dirty-bitmap ===
@@ -141,7 +141,7 @@ exports available: 2
max block: 33554432
available meta contexts: 2
base:allocation
- qemu:dirty-bitmap:b
+ qemu:dirty-bitmap:n
export: 'n2'
size: 4194304
flags: 0xced ( flush fua trim zeroes df cache fast-zero )
@@ -150,7 +150,7 @@ exports available: 2
max block: 33554432
available meta contexts: 2
base:allocation
- qemu:dirty-bitmap:b2
+ qemu:dirty-bitmap:n2
=== Contrast normal status to large granularity dirty-bitmap ===
--
2.21.0
- [PATCH] block: nbd: Fix dirty bitmap context name,
Nir Soffer <=
- Re: [PATCH] block: nbd: Fix dirty bitmap context name, Vladimir Sementsov-Ogievskiy, 2019/12/19
- Re: [PATCH] block: nbd: Fix dirty bitmap context name, Kevin Wolf, 2019/12/19
- Re: [PATCH] block: nbd: Fix dirty bitmap context name, Vladimir Sementsov-Ogievskiy, 2019/12/19
- Re: [PATCH] block: nbd: Fix dirty bitmap context name, Nir Soffer, 2019/12/19
- Re: [PATCH] block: nbd: Fix dirty bitmap context name, Vladimir Sementsov-Ogievskiy, 2019/12/19
- Re: [PATCH] block: nbd: Fix dirty bitmap context name, Nir Soffer, 2019/12/19
- Re: [PATCH] block: nbd: Fix dirty bitmap context name, Vladimir Sementsov-Ogievskiy, 2019/12/20
- Re: [PATCH] block: nbd: Fix dirty bitmap context name, Peter Krempa, 2019/12/20
- Re: [PATCH] block: nbd: Fix dirty bitmap context name, Vladimir Sementsov-Ogievskiy, 2019/12/20
- Re: [PATCH] block: nbd: Fix dirty bitmap context name, Peter Krempa, 2019/12/20