From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
Juan Quintela <quintela@redhat.com>,
qemu-devel@nongnu.org,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
Peter Krempa <pkrempa@redhat.com>, John Snow <jsnow@redhat.com>
Subject: Re: [PATCH for-5.2 v3 1/3] migration: Add block-bitmap-mapping parameter
Date: Wed, 12 Aug 2020 09:32:04 -0500 [thread overview]
Message-ID: <e5d25c70-3214-09fe-cc2c-0320b6f836ef@redhat.com> (raw)
In-Reply-To: <20200722080516.126147-2-mreitz@redhat.com>
On 7/22/20 3:05 AM, Max Reitz wrote:
> This migration parameter allows mapping block node names and bitmap
> names to aliases for the purpose of block dirty bitmap migration.
>
> This way, management tools can use different node and bitmap names on
> the source and destination and pass the mapping of how bitmaps are to be
> transferred to qemu (on the source, the destination, or even both with
> arbitrary aliases in the migration stream).
>
> Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> qapi/migration.json | 104 ++++++++-
> migration/migration.h | 3 +
> migration/block-dirty-bitmap.c | 373 ++++++++++++++++++++++++++++-----
> migration/migration.c | 30 +++
> monitor/hmp-cmds.c | 30 +++
> 5 files changed, 485 insertions(+), 55 deletions(-)
>
> diff --git a/qapi/migration.json b/qapi/migration.json
> index d5000558c6..d7e953cd73 100644
> --- a/qapi/migration.json
> +++ b/qapi/migration.json
> @@ -507,6 +507,44 @@
> 'data': [ 'none', 'zlib',
> { 'name': 'zstd', 'if': 'defined(CONFIG_ZSTD)' } ] }
>
> +##
> +# @BitmapMigrationBitmapAlias:
> +#
> +# @name: The name of the bitmap.
> +#
> +# @alias: An alias name for migration (for example the bitmap name on
> +# the opposite site).
> +#
> +# Since: 5.1
5.2, now, but I can touch that up if it is the only problem raised.
> +# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
> +# aliases for the purpose of dirty bitmap migration. Such
> +# aliases may for example be the corresponding names on the
> +# opposite site.
> +# The mapping must be one-to-one, and on the destination also
> +# complete: On the source, bitmaps on nodes where either the
> +# bitmap or the node is not mapped will be ignored. In
> +# contrast, on the destination, receiving a bitmap (by alias)
> +# from a node (by alias) when either alias is not mapped will
> +# result in an error.
Grammar is a bit odd and it feels repetitive. How about:
The mapping must not provide more than one alias for a bitmap, nor reuse
the same alias across multiple bitmaps in the same node. On the source,
an omitted node or bitmap within a node will ignore those bitmaps. In
contrast, on the destination, receiving a bitmap (by alias) from a node
(by alias) when either alias is not mapped will result in an error.
> +# Note that the destination does not know about bitmaps it
> +# does not receive, so there is no limitation or requirement
> +# regarding the number of bitmaps received, or how they are
> +# named, or on which nodes they are placed.
> +# By default (when this parameter has never been set), bitmap
> +# names are mapped to themselves. Nodes are mapped to their
> +# block device name if there is one, and to their node name
> +# otherwise. (Since 5.2)
Looks good.
> @@ -781,6 +839,25 @@
> # will consume more CPU.
> # Defaults to 1. (Since 5.0)
> #
> +# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
> +# aliases for the purpose of dirty bitmap migration. Such
> +# aliases may for example be the corresponding names on the
> +# opposite site.
Ah, the joys of duplicated text.
> +++ b/migration/block-dirty-bitmap.c
> @@ -128,7 +131,8 @@ typedef struct DirtyBitmapMigState {
>
> typedef struct DirtyBitmapLoadState {
> uint32_t flags;
> - char node_name[256];
> + char node_alias[256];
> + char bitmap_alias[256];
Do we properly check that alias names will never overflow?
> +static GHashTable *construct_alias_map(const BitmapMigrationNodeAliasList *bbm,
> + bool name_to_alias,
> + Error **errp)
> +{
> + GHashTable *alias_map;
> +
> + alias_map = g_hash_table_new_full(g_str_hash, g_str_equal,
> + g_free, free_alias_map_inner_node);
> +
> + for (; bbm; bbm = bbm->next) {
> + const BitmapMigrationNodeAlias *bmna = bbm->value;
> + const BitmapMigrationBitmapAliasList *bmbal;
> + AliasMapInnerNode *amin;
> + GHashTable *bitmaps_map;
> + const char *node_map_from, *node_map_to;
> +
> + if (!id_wellformed(bmna->alias)) {
> + error_setg(errp, "The node alias %s is not well-formed",
> + bmna->alias);
> + goto fail;
> + }
Maybe id_wellformed should enforce lengths? Otherwise, I'm not seeing a
length limit applied during the mapping process.
Modulo that, I think we're ready to go.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2020-08-12 14:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 8:05 [PATCH for-5.2 v3 0/3] migration: Add block-bitmap-mapping parameter Max Reitz
2020-07-22 8:05 ` [PATCH for-5.2 v3 1/3] " Max Reitz
2020-08-12 14:32 ` Eric Blake [this message]
2020-08-13 13:03 ` Max Reitz
2020-07-22 8:05 ` [PATCH for-5.2 v3 2/3] iotests.py: Add wait_for_runstate() Max Reitz
2020-07-22 8:05 ` [PATCH for-5.2 v3 3/3] iotests: Test node/bitmap aliases during migration Max Reitz
2020-08-12 14:15 ` [PATCH for-5.2 v3 0/3] migration: Add block-bitmap-mapping parameter Max Reitz
2020-08-12 14:38 ` Vladimir Sementsov-Ogievskiy
2020-08-13 13:04 ` Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e5d25c70-3214-09fe-cc2c-0320b6f836ef@redhat.com \
--to=eblake@redhat.com \
--cc=dgilbert@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pkrempa@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).