qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Peter Krempa <pkrempa@redhat.com>
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-block@nongnu.org, Juan Quintela <quintela@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	qemu-devel@nongnu.org,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [RFC v2] migration: Add migrate-set-bitmap-node-mapping
Date: Tue, 2 Jun 2020 12:56:32 +0200	[thread overview]
Message-ID: <1216f9b8-d9b6-204c-b0a9-06c14b286413@redhat.com> (raw)
In-Reply-To: <20200518162648.GC2995787@angien.pipo.sk>


[-- Attachment #1.1: Type: text/plain, Size: 5489 bytes --]

On 18.05.20 18:26, Peter Krempa wrote:
> On Wed, May 13, 2020 at 16:56:10 +0200, Max Reitz wrote:
>> This command allows mapping block node names to aliases for the purpose
>> of block dirty bitmap migration.
>>
>> This way, management tools can use different node 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            | 36 ++++++++++++++++++++
>>  migration/block-dirty-bitmap.c | 60 ++++++++++++++++++++++++++++++++--
>>  2 files changed, 94 insertions(+), 2 deletions(-)
> 
> I just started to write some quick and dirty hacks to test use of this
> infrastructure in libvirt. I have 2 quick observations for now:
> 
>>
>> diff --git a/qapi/migration.json b/qapi/migration.json
>> index d5000558c6..97037ea635 100644
>> --- a/qapi/migration.json
>> +++ b/qapi/migration.json
>> @@ -1621,3 +1621,39 @@
>>  ##
>>  { 'event': 'UNPLUG_PRIMARY',
>>    'data': { 'device-id': 'str' } }
>> +
>> +##
>> +# @MigrationBlockNodeMapping:
>> +#
>> +# Maps a block node name to an alias for migration.
>> +#
>> +# @node-name: A block node name.
>> +#
>> +# @alias: An alias name for migration (for example the node name on
>> +#         the opposite site).
>> +#
>> +# Since: 5.1
>> +##
>> +{ 'struct': 'MigrationBlockNodeMapping',
>> +  'data': {
>> +      'node-name': 'str',
>> +      'alias': 'str'
>> +  } }
> 
> We'd probably like a
> 'nodename:bitmapname' -> 'alias' mapping so that we can select which
> bitmaps to migrate and where to migrate them to.

Sure, entirely doable.

I think Vladimir is right that we’d want separate node and bitmap
aliases then, though, because the migration stream has both fields.
(Also, if we only had a single alias, you’d always need to call
migrate-set-bitmap-(node-)mapping on both ends to unpack that alias.
With separate node and bitmap aliases, it suffices to call it on one
end, just like the version in thie patch.)

> The specific use case
> is following:
> 
> Libvirt supports migration without shared storage (NFS/etc) where we
> copy the disk images prior to the memory migration using qemu's NBD
> server and the blockdev-mirror job. By default and the most simple way
> which doesn't require users fudging with the disk images and copying
> backing images themselves is that we flatten all the backing chain
> during the copy ("sync":"full"). In this mode we'll need to do some
> merging of the bitmaps prior to finalizing the copy.
> 
> It's not a problem to do it ourselves, but in the end we'll need to copy
> only certain bitmaps which will be created temporarily on the source to
> the destination where they'll be persisted.
> 
> For now (until I implement the use of the dirty-bitmap-populate blockjob
> which I'm also doing in parallel with this kind of) when creating a
> snapshot we create a new active bitmap in the overlay for every active
> bitmap in the snapshotted image.
> 
> When flattening we'll then need to merge the appropriate ones. As said
> it's not a problem to prepare all the bitmaps before but we then don't
> need to migrate all of them.
> 
> By the way, that brings me to another question:
> 
> Is there any difference of handling of persistent and non-persistent
> bitmaps? Specifically I'm curious what's the correct approach to do the
> shared storage migration case when the source and destination image is
> the same one. Should we also instruct to migrate the active ones? or are
> they migrated by writing them to the image and reloading them?

I hope Vladimir has answered your question sufficiently extensively. :)

>> +##
>> +# @migrate-set-bitmap-node-mapping:
> 
> qemu-5.0 deprecated a bunch of migrate-set- specific commands in favor
> of migrate-set-parameters. Is it worth/necessary to add a new command
> here?

I wasn’t aware of that.  It would probably indeed make sense from a
user’s perspective.

It would make the implementation rather different, though, because
instead of putting the mapping locally (and statically) into
migration/block-dirty-bitmap.c, it would require putting it into the
central MigrationState.  Which isn’t to say it’d be worse.  I suppose
it’d be better, actually, but I’ll have to try to say for sure.

You also suggested “setting nothing will clear the mapping” in your
second mail.  That would be a weird default.  Right now, the default for
all migration parameters is to leave them as-is, so it would be different.

The first question would be: What do you mean by “clear the mapping”?
Reset it to the original identity mapping?  Or actually clear it, so
that no bitmap is migrated?  I presume the former, because the latter
can easily be achieved by passing an empty array.

I understand that it seems to make sense to be able to return to the
original identity mapping, but is there actually a use for this?  After
you have started using a custom mapping, wouldn’t you always use custom
mappings?

If there is a use for it, I think the better way to do it would be to
use an alternate type where an explicit null resets the mapping to the
identity mapping.

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2020-06-02 10:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13 14:56 [RFC v2] migration: Add migrate-set-bitmap-node-mapping Max Reitz
2020-05-13 16:11 ` Eric Blake
2020-05-14  7:13   ` Max Reitz
2020-05-14 11:07     ` Kevin Wolf
2020-05-13 20:09 ` Vladimir Sementsov-Ogievskiy
2020-05-14  7:42   ` Max Reitz
2020-05-14  9:09   ` Max Reitz
2020-05-14 10:58     ` Vladimir Sementsov-Ogievskiy
2020-05-14 11:04     ` Kevin Wolf
2020-05-14  8:42 ` Dr. David Alan Gilbert
2020-05-14  9:08   ` Max Reitz
2020-05-14  9:32     ` Dr. David Alan Gilbert
2020-05-18 16:26 ` Peter Krempa
2020-05-18 17:52   ` Vladimir Sementsov-Ogievskiy
2020-05-18 18:20     ` Peter Krempa
2020-05-18 18:47       ` Vladimir Sementsov-Ogievskiy
2020-06-02 10:56   ` Max Reitz [this message]
2020-06-02 11:12     ` Peter Krempa

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=1216f9b8-d9b6-204c-b0a9-06c14b286413@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@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).