aboutsummaryrefslogtreecommitdiff
path: root/qemu-nbd.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2020-10-27 00:05:49 -0500
committerEric Blake <eblake@redhat.com>2020-10-30 15:10:15 -0500
commitcbad81cef8cc7b220f04600997ea29d7302bae00 (patch)
treeb99f92ee23a0a2eb40efdad1a493e373c9cdcb60 /qemu-nbd.c
parent8675cbd68be7da35a61e391fbb5b95ac67bc7d72 (diff)
downloadqemu-cbad81cef8cc7b220f04600997ea29d7302bae00.zip
qemu-cbad81cef8cc7b220f04600997ea29d7302bae00.tar.gz
qemu-cbad81cef8cc7b220f04600997ea29d7302bae00.tar.bz2
nbd: Update qapi to support exporting multiple bitmaps
Since 'block-export-add' is new to 5.2, we can still tweak the interface; there, allowing 'bitmaps':['str'] is nicer than 'bitmap':'str'. This wires up the qapi and qemu-nbd changes to permit passing multiple bitmaps as distinct metadata contexts that the NBD client may request, but the actual support for more than one will require a further patch to the server. Note that there are no changes made to the existing deprecated 'nbd-server-add' command; this required splitting the QAPI type BlockExportOptionsNbd, which fortunately does not affect QMP introspection. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20201027050556.269064-5-eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Diffstat (limited to 'qemu-nbd.c')
-rw-r--r--qemu-nbd.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/qemu-nbd.c b/qemu-nbd.c
index a0701cd..74e73a7 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -574,7 +574,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;
- const char *bitmap = NULL;
+ strList *bitmaps = NULL;
const char *tlscredsid = NULL;
bool imageOpts = false;
bool writethrough = true;
@@ -690,7 +690,7 @@ int main(int argc, char **argv)
flags &= ~BDRV_O_RDWR;
break;
case 'B':
- bitmap = optarg;
+ QAPI_LIST_PREPEND(bitmaps, g_strdup(optarg));
break;
case 'k':
sockpath = optarg;
@@ -786,7 +786,7 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
if (export_name || export_description || dev_offset ||
- device || disconnect || fmt || sn_id_or_name || bitmap ||
+ device || disconnect || fmt || sn_id_or_name || bitmaps ||
seen_aio || seen_discard || seen_cache) {
error_report("List mode is incompatible with per-device settings");
exit(EXIT_FAILURE);
@@ -1067,12 +1067,12 @@ int main(int argc, char **argv)
.has_writable = true,
.writable = !readonly,
.u.nbd = {
- .has_name = true,
- .name = g_strdup(export_name),
- .has_description = !!export_description,
- .description = g_strdup(export_description),
- .has_bitmap = !!bitmap,
- .bitmap = g_strdup(bitmap),
+ .has_name = true,
+ .name = g_strdup(export_name),
+ .has_description = !!export_description,
+ .description = g_strdup(export_description),
+ .has_bitmaps = !!bitmaps,
+ .bitmaps = bitmaps,
},
};
blk_exp_add(export_opts, &error_fatal);