Skip to contentSkip to conversation

qapi: nbd-export: select bitmap by node/name pair

PATCH In review Vladimir Sementsov-Ogievskiy 4 participants 14 messages Mar 14, 2022 – Apr 22, 2022 Block layer

lore
Share & tools
lore
#0 lore raw

v2 cover qapi: nbd-export: select bitmap by node/name pair

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Hi all!

Here is small improvement for bitmap exporting interface.

v2: Sorry for the noise, me trying to find a email service, that don't consider sending patch series by git-send-email as as spam :/

Vladimir Sementsov-Ogievskiy (3):
qapi: rename BlockDirtyBitmapMergeSource to BlockDirtyBitmapOrStr
qapi: nbd-export: allow select bitmaps by node/name pair iotests/223: check new possibility of exporting bitmaps by node/name

 block/monitor/bitmap-qmp-cmds.c        |  6 +--
 blockdev-nbd.c                         |  8 +++-
 include/block/block_int-global-state.h |  2 +-
 nbd/server.c                           | 63 +++++++++++++++++---------
 qapi/block-core.json                   |  6 +--
 qapi/block-export.json                 |  5 +-
 qemu-img.c                             |  8 ++--
 qemu-nbd.c                             | 11 ++++-
 tests/qemu-iotests/223                 | 16 +++++++
 tests/qemu-iotests/223.out             | 47 ++++++++++++++++++-
 10 files changed, 133 insertions(+), 39 deletions(-)
Signature · 1 line
2.35.1
#1 lore raw
Quoted 8 lines · Vladimir Sementsov-Ogievskiy

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Hi all!

Here is small improvement for bitmap exporting interface.

v2: Sorry for the noise, me trying to find a email service, that don't consider sending patch series by git-send-email as as spam :/

Aha, and @mail.ru works a lot better. So, that's a candidate for v2 of my "[PATCH] MAINTAINERS: change Vladimir's email address".

This series itself is OK for reviewing, but email in s-o-b mark may change in v3.

Quoted 18 lines

Vladimir Sementsov-Ogievskiy (3):
qapi: rename BlockDirtyBitmapMergeSource to BlockDirtyBitmapOrStr
qapi: nbd-export: allow select bitmaps by node/name pair iotests/223: check new possibility of exporting bitmaps by node/name

  block/monitor/bitmap-qmp-cmds.c        |  6 +--
  blockdev-nbd.c                         |  8 +++-
  include/block/block_int-global-state.h |  2 +-
  nbd/server.c                           | 63 +++++++++++++++++---------
  qapi/block-core.json                   |  6 +--
  qapi/block-export.json                 |  5 +-
  qemu-img.c                             |  8 ++--
  qemu-nbd.c                             | 11 ++++-
  tests/qemu-iotests/223                 | 16 +++++++
  tests/qemu-iotests/223.out             | 47 ++++++++++++++++++-
  10 files changed, 133 insertions(+), 39 deletions(-)
Signature · 2 lines
Best regards,
Vladimir
#2 lore raw
Quoted 5 lines · Vladimir Sementsov-Ogievskiy
Quoted 4 lines · Vladimir Sementsov-Ogievskiy

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Hi all!

Quoted 8 lines
Quoted 4 lines

Here is small improvement for bitmap exporting interface.

v2: Sorry for the noise, me trying to find a email service, that don't consider sending patch series by git-send-email as as spam :/

Aha, and @mail.ru works a lot better. So, that's a candidate for v2 of my "[PATCH] MAINTAINERS: change Vladimir's email address".

This series itself is OK for reviewing, but email in s-o-b mark may change in v3.

Vladimir, do I have your permission to alter your S-o-b marks from @ya.ru to @mail.ru (since we have established that you have sent mail from both addresses, but selected @mail.ru in MAINTAINERS)? That's the only thing that's preventing me from queuing this series as-is.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#3 lore raw

PATCH v2 1/3 qapi: rename BlockDirtyBitmapMergeSource to BlockDirtyBitmapOrStr

In reply to Vladimir Sementsov-Ogievskiy

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Rename the type to be reused. Old name is "what is it for". To be natively reused for other needs, let's name it exactly "what is it".

---
 block/monitor/bitmap-qmp-cmds.c        | 6 +++---
 include/block/block_int-global-state.h | 2 +-
 qapi/block-core.json                   | 6 +++---
 qemu-img.c                             | 8 ++++----
 4 files changed, 11 insertions(+), 11 deletions(-)
block/monitor/bitmap-qmp-cmds.c +3 -3
index 8e35616c2e..2b677c4a2f 100644
@@ -257,12 +257,12 @@ void qmp_block_dirty_bitmap_disable(const char *node, const char *name,
 }
 
 BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target,
-                                          BlockDirtyBitmapMergeSourceList *bms,
+                                          BlockDirtyBitmapOrStrList *bms,
                                           HBitmap **backup, Error **errp)
 {
     BlockDriverState *bs;
     BdrvDirtyBitmap *dst, *src, *anon;
-    BlockDirtyBitmapMergeSourceList *lst;
+    BlockDirtyBitmapOrStrList *lst;
 
     GLOBAL_STATE_CODE();
 
@@ -317,7 +317,7 @@ BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target,
 }
 
 void qmp_block_dirty_bitmap_merge(const char *node, const char *target,
-                                  BlockDirtyBitmapMergeSourceList *bitmaps,
+                                  BlockDirtyBitmapOrStrList *bitmaps,
                                   Error **errp)
 {
     block_dirty_bitmap_merge(node, target, bitmaps, NULL, errp);
include/block/block_int-global-state.h +1 -1
index 0f21b0570b..8b2e95f5ff 100644
@@ -262,7 +262,7 @@ BdrvDirtyBitmap *block_dirty_bitmap_lookup(const char *node,
                                            BlockDriverState **pbs,
                                            Error **errp);
 BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target,
-                                          BlockDirtyBitmapMergeSourceList *bms,
+                                          BlockDirtyBitmapOrStrList *bms,
                                           HBitmap **backup, Error **errp);
 BdrvDirtyBitmap *block_dirty_bitmap_remove(const char *node, const char *name,
                                            bool release,
qapi/block-core.json +3 -3
index e89f2dfb5b..c0eacd66db 100644
@@ -2078,7 +2078,7 @@
             '*persistent': 'bool', '*disabled': 'bool' } }
 
 ##
-# @BlockDirtyBitmapMergeSource:
+# @BlockDirtyBitmapOrStr:
 #
 # @local: name of the bitmap, attached to the same node as target bitmap.
 #
@@ -2086,7 +2086,7 @@
 #
 # Since: 4.1
 ##
-{ 'alternate': 'BlockDirtyBitmapMergeSource',
+{ 'alternate': 'BlockDirtyBitmapOrStr',
   'data': { 'local': 'str',
             'external': 'BlockDirtyBitmap' } }
 
@@ -2105,7 +2105,7 @@
 ##
 { 'struct': 'BlockDirtyBitmapMerge',
   'data': { 'node': 'str', 'target': 'str',
-            'bitmaps': ['BlockDirtyBitmapMergeSource'] } }
+            'bitmaps': ['BlockDirtyBitmapOrStr'] } }
 
 ##
 # @block-dirty-bitmap-add:
qemu-img.c +4 -4
index 5dffb3e616..f853efe6fb 100644
@@ -1618,16 +1618,16 @@ static void do_dirty_bitmap_merge(const char *dst_node, const char *dst_name,
                                   const char *src_node, const char *src_name,
                                   Error **errp)
 {
-    BlockDirtyBitmapMergeSource *merge_src;
-    BlockDirtyBitmapMergeSourceList *list = NULL;
+    BlockDirtyBitmapOrStr *merge_src;
+    BlockDirtyBitmapOrStrList *list = NULL;
 
-    merge_src = g_new0(BlockDirtyBitmapMergeSource, 1);
+    merge_src = g_new0(BlockDirtyBitmapOrStr, 1);
     merge_src->type = QTYPE_QDICT;
     merge_src->u.external.node = g_strdup(src_node);
     merge_src->u.external.name = g_strdup(src_name);
     QAPI_LIST_PREPEND(list, merge_src);
     qmp_block_dirty_bitmap_merge(dst_node, dst_name, list, errp);
-    qapi_free_BlockDirtyBitmapMergeSourceList(list);
+    qapi_free_BlockDirtyBitmapOrStrList(list);
 }
 
 enum ImgConvertBlockStatus {
Signature · 1 line
2.35.1
Reviewed-by on v2 1/3
#4 lore raw

Re: [PATCH v2 1/3] qapi: rename BlockDirtyBitmapMergeSource to BlockDirtyBitmapOrStr

Quoted 5 lines · Vladimir Sementsov-Ogievskiy

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Rename the type to be reused. Old name is "what is it for". To be natively reused for other needs, let's name it exactly "what is it".

Quoted 7 lines
---
 block/monitor/bitmap-qmp-cmds.c        | 6 +++---
 include/block/block_int-global-state.h | 2 +-
 qapi/block-core.json                   | 6 +++---
 qemu-img.c                             | 8 ++++----
 4 files changed, 11 insertions(+), 11 deletions(-)

The type name does not affect QAPI interface stability, so this is safe.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Acked-by
#5 lore raw

Re: [PATCH v2 1/3] qapi: rename BlockDirtyBitmapMergeSource to BlockDirtyBitmapOrStr

Quoted 15 lines · Eric Blake
Quoted 5 lines · Vladimir Sementsov-Ogievskiy

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Rename the type to be reused. Old name is "what is it for". To be natively reused for other needs, let's name it exactly "what is it".

Quoted 7 lines
---
 block/monitor/bitmap-qmp-cmds.c        | 6 +++---
 include/block/block_int-global-state.h | 2 +-
 qapi/block-core.json                   | 6 +++---
 qemu-img.c                             | 8 ++++----
 4 files changed, 11 insertions(+), 11 deletions(-)
Quoted 3 lines

The type name does not affect QAPI interface stability, so this is safe.

Sounds right.

#6 lore raw

PATCH v2 2/3 qapi: nbd-export: allow select bitmaps by node/name pair

In reply to Vladimir Sementsov-Ogievskiy

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Hi all! Current logic of relying on search through backing chain is not safe neither convenient.

Sometimes it leads to necessity of extra bitmap copying. Also, we are going to add "snapshot-access" driver, to access some snapshot state through NBD. And this driver is not formally a filter, and of course it's not a COW format driver. So, searching through backing chain will not work. Instead of widening the workaround of bitmap searching, let's extend the interface so that user can select bitmap precisely.

Note, that checking for bitmap active status is not copied to the new API, I don't see a reason for it, user should understand the risks. And anyway, bitmap from other node is unrelated to this export being read-only or read-write.

---
 blockdev-nbd.c         |  8 +++++-
 nbd/server.c           | 63 +++++++++++++++++++++++++++---------------
 qapi/block-export.json |  5 +++-
 qemu-nbd.c             | 11 ++++++--
 4 files changed, 61 insertions(+), 26 deletions(-)
blockdev-nbd.c +7 -1
index 9840d25a82..7f6531cba0 100644
@@ -211,8 +211,14 @@ void qmp_nbd_server_add(NbdServerAddOptions *arg, Error **errp)
     QAPI_CLONE_MEMBERS(BlockExportOptionsNbdBase, &export_opts->u.nbd,
                        qapi_NbdServerAddOptions_base(arg));
     if (arg->has_bitmap) {
+        BlockDirtyBitmapOrStr *el = g_new(BlockDirtyBitmapOrStr, 1);
+
+        *el = (BlockDirtyBitmapOrStr) {
+            .type = QTYPE_QSTRING,
+            .u.local = g_strdup(arg->bitmap),
+        };
         export_opts->u.nbd.has_bitmaps = true;
-        QAPI_LIST_PREPEND(export_opts->u.nbd.bitmaps, g_strdup(arg->bitmap));
+        QAPI_LIST_PREPEND(export_opts->u.nbd.bitmaps, el);
     }
 
     /*
nbd/server.c +41 -22

85 lines not on this page · raw message

qapi/block-export.json +4 -1
index f183522d0d..6afed472ff 100644
@@ -6,6 +6,7 @@
 ##
 
 { 'include': 'sockets.json' }
+{ 'include': 'block-core.json' }
 
 ##
 # @NbdServerOptions:
@@ -89,6 +90,7 @@
 #           @device, so the NBD client can use NBD_OPT_SET_META_CONTEXT with
 #           the metadata context name "qemu:dirty-bitmap:BITMAP" to inspect
 #           each bitmap.
+#           Since 7.1 bitmap may be specified by node/name pair.
 #
 # @allocation-depth: Also export the allocation depth map for @device, so
 #                    the NBD client can use NBD_OPT_SET_META_CONTEXT with
@@ -99,7 +101,8 @@
 ##
 { 'struct': 'BlockExportOptionsNbd',
   'base': 'BlockExportOptionsNbdBase',
-  'data': { '*bitmaps': ['str'], '*allocation-depth': 'bool' } }
+  'data': { '*bitmaps': ['BlockDirtyBitmapOrStr'],
+            '*allocation-depth': 'bool' } }
 
 ##
 # @BlockExportOptionsVhostUserBlk:
qemu-nbd.c +9 -2
index 713e7557a9..72138f703e 100644
@@ -567,7 +567,7 @@ int main(int argc, char **argv)
     QDict *options = NULL;
     const char *export_name = NULL; /* defaults to "" later for server mode */
     const char *export_description = NULL;
-    strList *bitmaps = NULL;
+    BlockDirtyBitmapOrStrList *bitmaps = NULL;
     bool alloc_depth = false;
     const char *tlscredsid = NULL;
     const char *tlshostname = NULL;
@@ -687,7 +687,14 @@ int main(int argc, char **argv)
             alloc_depth = true;
             break;
         case 'B':
-            QAPI_LIST_PREPEND(bitmaps, g_strdup(optarg));
+            {
+                BlockDirtyBitmapOrStr *el = g_new(BlockDirtyBitmapOrStr, 1);
+                *el = (BlockDirtyBitmapOrStr) {
+                    .type = QTYPE_QSTRING,
+                    .u.local = g_strdup(optarg),
+                };
+                QAPI_LIST_PREPEND(bitmaps, el);
+            }
             break;
         case 'k':
             sockpath = optarg;
Signature · 1 line
2.35.1
#7 lore raw

Re: [PATCH v2 2/3] qapi: nbd-export: allow select bitmaps by node/name pair

Quoted 27 lines · Vladimir Sementsov-Ogievskiy

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Hi all! Current logic of relying on search through backing chain is not safe neither convenient.

Sometimes it leads to necessity of extra bitmap copying. Also, we are going to add "snapshot-access" driver, to access some snapshot state through NBD. And this driver is not formally a filter, and of course it's not a COW format driver. So, searching through backing chain will not work. Instead of widening the workaround of bitmap searching, let's extend the interface so that user can select bitmap precisely.

Note, that checking for bitmap active status is not copied to the new API, I don't see a reason for it, user should understand the risks. And anyway, bitmap from other node is unrelated to this export being read-only or read-write.

---
 blockdev-nbd.c         |  8 +++++-
 nbd/server.c           | 63 +++++++++++++++++++++++++++---------------
 qapi/block-export.json |  5 +++-
 qemu-nbd.c             | 11 ++++++--
 4 files changed, 61 insertions(+), 26 deletions(-)

nbd/server.c static int nbd_export_create(BlockExport *blk_exp, BlockExportOptions *exp_args, · line 1714

Quoted 8 lines
nbd/server.c +3 -2
@@ -1709,37 +1709,56 @@ static int nbd_export_create(BlockExport *blk_exp, BlockExportOptions *exp_args,
     }
     exp->export_bitmaps = g_new0(BdrvDirtyBitmap *, exp->nr_export_bitmaps);
     for (i = 0, bitmaps = arg->bitmaps; bitmaps;
-         i++, bitmaps = bitmaps->next) {
-        const char *bitmap = bitmaps->value;
+         i++, bitmaps = bitmaps->next)
+    {
+        const char *bitmap;

I'm not sure if our prevailing style splits { to its own line on a multi-line 'for'. But this is a cosmetic question, not one of correctness.

nbd/server.c static int nbd_export_create(BlockExport *blk_exp, BlockExportOptions *exp_args, · line 1755

Quoted 11 lines
nbd/server.c +11 -0
+        case QTYPE_QDICT:
+            bitmap = bitmaps->value->u.external.name;
+            bm = block_dirty_bitmap_lookup(bitmaps->value->u.external.node,
+                                           bitmap, NULL, errp);
+            if (!bm) {
+                ret = -ENOENT;
+                goto fail;
+            }
+            break;
+        default:
+            abort();

Not sure if g_assert_not_reached() or __builtin_unreachable() would be any better here. I'm fine with the abort() for now.

qapi/block-export.json line 9

Quoted 6 lines
qapi/block-export.json +2 -0
+++ b/qapi/block-export.json
@@ -6,6 +6,7 @@
 ##
 
 { 'include': 'sockets.json' }
+{ 'include': 'block-core.json' }

Hmm. Does this extra inclusion negatively impact qemu-storage-daemon, since that is why we created block-export.json in the first place (to minimize the stuff that qsd pulled in without needing all of block-core.json)? In other words, would it be better to move BlockDirtyBitmapOrStr to this file?

Everything else looks okay with this patch.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#8 lore raw

Re: [PATCH v2 2/3] qapi: nbd-export: allow select bitmaps by node/name pair

Quoted 60 lines · Eric Blake
Quoted 27 lines · Vladimir Sementsov-Ogievskiy

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Hi all! Current logic of relying on search through backing chain is not safe neither convenient.

Sometimes it leads to necessity of extra bitmap copying. Also, we are going to add "snapshot-access" driver, to access some snapshot state through NBD. And this driver is not formally a filter, and of course it's not a COW format driver. So, searching through backing chain will not work. Instead of widening the workaround of bitmap searching, let's extend the interface so that user can select bitmap precisely.

Note, that checking for bitmap active status is not copied to the new API, I don't see a reason for it, user should understand the risks. And anyway, bitmap from other node is unrelated to this export being read-only or read-write.

---
  blockdev-nbd.c         |  8 +++++-
  nbd/server.c           | 63 +++++++++++++++++++++++++++---------------
  qapi/block-export.json |  5 +++-
  qemu-nbd.c             | 11 ++++++--
  4 files changed, 61 insertions(+), 26 deletions(-)

nbd/server.c static int nbd_export_create(BlockExport *blk_exp, BlockExportOptions *exp_args, · line 1714

Quoted 8 lines
nbd/server.c +3 -2
@@ -1709,37 +1709,56 @@ static int nbd_export_create(BlockExport *blk_exp, BlockExportOptions *exp_args,
      }
      exp->export_bitmaps = g_new0(BdrvDirtyBitmap *, exp->nr_export_bitmaps);
      for (i = 0, bitmaps = arg->bitmaps; bitmaps;
-         i++, bitmaps = bitmaps->next) {
-        const char *bitmap = bitmaps->value;
+         i++, bitmaps = bitmaps->next)
+    {
+        const char *bitmap;

I'm not sure if our prevailing style splits { to its own line on a multi-line 'for'. But this is a cosmetic question, not one of correctness.

nbd/server.c static int nbd_export_create(BlockExport *blk_exp, BlockExportOptions *exp_args, · line 1755

Quoted 11 lines
nbd/server.c +11 -0
+        case QTYPE_QDICT:
+            bitmap = bitmaps->value->u.external.name;
+            bm = block_dirty_bitmap_lookup(bitmaps->value->u.external.node,
+                                           bitmap, NULL, errp);
+            if (!bm) {
+                ret = -ENOENT;
+                goto fail;
+            }
+            break;
+        default:
+            abort();

Not sure if g_assert_not_reached() or __builtin_unreachable() would be any better here. I'm fine with the abort() for now.

Quoted 4 lines
(quoted diff) +1 -0
+++ b/qapi/block-export.json
@@ -6,6 +6,7 @@
  ##
 
Quoted 8 lines

qapi/block-export.json line 9

Quoted 2 lines
qapi/block-export.json +1 -0
  { 'include': 'sockets.json' }
+{ 'include': 'block-core.json' }

Hmm. Does this extra inclusion negatively impact qemu-storage-daemon, since that is why we created block-export.json in the first place (to minimize the stuff that qsd pulled in without needing all of block-core.json)? In other words, would it be better to move BlockDirtyBitmapOrStr to this file?

And include block-export in block-core?

Another alternative is to move BlockDirtyBitmapOrStr to a separate file included from both block-export and block-core but that seems to be too much.

Quoted 3 lines

Everything else looks okay with this patch.

Signature · 2 lines
Best regards,
Vladimir
#9 lore raw

Re: [PATCH v2 2/3] qapi: nbd-export: allow select bitmaps by node/name pair

Quoted 12 lines · Vladimir Sementsov-Ogievskiy
Quoted 11 lines

qapi/block-export.json line 8

Quoted 5 lines

+++ b/qapi/block-export.json

qapi/block-export.json +1 -0
@@ -6,6 +6,7 @@
  ##
  { 'include': 'sockets.json' }
+{ 'include': 'block-core.json' }

Hmm. Does this extra inclusion negatively impact qemu-storage-daemon, since that is why we created block-export.json in the first place (to minimize the stuff that qsd pulled in without needing all of block-core.json)? In other words, would it be better to move BlockDirtyBitmapOrStr to this file?

Quoted 1 line

And include block-export in block-core?

Right now, we have:

qapi/block-core.json "Block core (VM unrelated)" - includes {common,crypto,job,sockets}.json

qapi/block-export.json "Block device exports" - includes sockets.json

qapi/block.json "Additional block stuff (VM related)" - includes block-core.json

Kevin, you forked off qapi/block-export.json. What do you propose here?

Quoted 2 lines

Another alternative is to move BlockDirtyBitmapOrStr to a separate file included from both block-export and block-core but that seems to be too much.

Indeed, that feels like a step too far; we already have confusion on which file to stick new stuff in, and adding another file won't help that.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#10 lore raw

Re: [PATCH v2 2/3] qapi: nbd-export: allow select bitmaps by node/name pair

In reply to Eric Blake
Quoted 11 lines · Eric Blake

qapi/block-export.json line 9

Quoted 6 lines

+++ b/qapi/block-export.json

qapi/block-export.json +1 -0
@@ -6,6 +6,7 @@
  ##
 
  { 'include': 'sockets.json' }
+{ 'include': 'block-core.json' }

Hmm. Does this extra inclusion negatively impact qemu-storage-daemon, since that is why we created block-export.json in the first place (to minimize the stuff that qsd pulled in without needing all of block-core.json)? In other words, would it be better to move BlockDirtyBitmapOrStr to this file?

Actually, looking at storage-daemon/qapi/qapi-schema.json I see block-cores.json.

That's block.json which is not mentioned in storage-daemon/qapi/qapi-schema.json.

So, I think it's OK to keep simple include for now.

Signature · 2 lines
Best regards,
Vladimir
Reviewed-by
#11 lore raw

Re: [PATCH v2 2/3] qapi: nbd-export: allow select bitmaps by node/name pair

Quoted 12 lines · Vladimir Sementsov-Ogievskiy
Quoted 10 lines · Eric Blake

qapi/block-export.json line 8

Quoted 5 lines

+++ b/qapi/block-export.json

qapi/block-export.json +1 -0
@@ -6,6 +6,7 @@
  ##
  { 'include': 'sockets.json' }
+{ 'include': 'block-core.json' }

Hmm. Does this extra inclusion negatively impact qemu-storage-daemon, since that is why we created block-export.json in the first place (to minimize the stuff that qsd pulled in without needing all of block-core.json)? In other words, would it be better to move BlockDirtyBitmapOrStr to this file?

Quoted 5 lines

Actually, looking at storage-daemon/qapi/qapi-schema.json I see block-cores.json.

That's block.json which is not mentioned in storage-daemon/qapi/qapi-schema.json.

So, I think it's OK to keep simple include for now.

We're early enough in the 7.1 cycle that if someone proposes a reason why this would need to change, then we can adjust it.

So for now, I'm adding

and queuing this series through my NBD tree.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#12 lore raw

PATCH v2 3/3 iotests/223: check new possibility of exporting bitmaps by node/name

In reply to Vladimir Sementsov-Ogievskiy

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Add simple test that new interface introduced in previous commit works.

---
 tests/qemu-iotests/223     | 16 +++++++++++++
 tests/qemu-iotests/223.out | 47 ++++++++++++++++++++++++++++++++++++--
 2 files changed, 61 insertions(+), 2 deletions(-)
tests/qemu-iotests/223 +16 -0
index da87f2f4a2..0bbb283010 100755
@@ -120,6 +120,11 @@ _send_qemu_cmd $QEMU_HANDLE '{"execute":"blockdev-add",
     "file":{"driver":"file", "filename":"'"$TEST_IMG"'"}}}' "return"
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"block-dirty-bitmap-disable",
   "arguments":{"node":"n", "name":"b"}}' "return"
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"blockdev-add",
+  "arguments":{"driver":"null-co", "node-name":"null",
+    "size": 4194304}}' "return"
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"block-dirty-bitmap-add",
+  "arguments":{"node":"null", "name":"b3"}}' "return"
 
 for attempt in normal iothread; do
 
@@ -155,6 +160,9 @@ _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add",
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add",
   "arguments":{"device":"n", "name":"n2", "writable":true,
   "description":"some text", "bitmap":"b2"}}' "return"
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"block-export-add",
+  "arguments":{"type": "nbd", "node-name":"n", "id":"n3", "name": "n3",
+  "bitmaps":[{"node":"null","name":"b3"}]}}' "return"
 $QEMU_NBD_PROG -L -k "$SOCK_DIR/nbd"
 
 echo
@@ -178,6 +186,14 @@ 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
 
+echo
+echo "=== Check bitmap taken from another node ==="
+echo
+
+IMG="driver=nbd,export=n3,server.type=unix,server.path=$SOCK_DIR/nbd"
+$QEMU_IMG map --output=json --image-opts \
+  "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b3" | _filter_qemu_img_map
+
 echo
 echo "=== End qemu NBD server ==="
 echo
tests/qemu-iotests/223.out +45 -2

101 lines not on this page · raw message

Signature · 1 line
2.35.1
Reviewed-by on v2 3/3
#13 lore raw

Re: [PATCH v2 3/3] iotests/223: check new possibility of exporting bitmaps by node/name

Quoted 9 lines · Vladimir Sementsov-Ogievskiy

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Add simple test that new interface introduced in previous commit works.

---
 tests/qemu-iotests/223     | 16 +++++++++++++
 tests/qemu-iotests/223.out | 47 ++++++++++++++++++++++++++++++++++++--
 2 files changed, 61 insertions(+), 2 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org