From: Eric Blake <eblake@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH 05/10] block: Inactivate BDS when migration completes
Date: Tue, 22 Dec 2015 13:43:10 -0700 [thread overview]
Message-ID: <5679B5DE.5070205@redhat.com> (raw)
In-Reply-To: <1450802786-20893-6-git-send-email-kwolf@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3379 bytes --]
On 12/22/2015 09:46 AM, Kevin Wolf wrote:
> So far, live migration with shared storage meant that the image is in a
> not-really-ready don't-touch-me state on the destination while the
> source is still actively using it, but after completing the migration,
> the image was fully opened on both sides. This is bad.
>
> This patch adds a block driver callback to inactivate images on the
> source before completing the migration. Inactivation means that it goes
> to a state as if it was just live migrated to the qemu instance on the
> source (i.e. BDRV_O_INCOMING is set). You're then supposed to continue
> either on the source or on the destination, which takes ownership of the
> image.
>
> A typical migration looks like this now with respect to disk images:
>
> 1. Destination qemu is started, the image is opened with
> BDRV_O_INCOMING. The image is fully opened on the source.
>
> 2. Migration is about to complete. The source flushes the image and
> inactivates it. Now both sides have the image opened with
> BDRV_O_INCOMING and are expecting the other side to still modify it.
The name BDRV_O_INCOMING now doesn't quite match semantics on the
source, but I don't have any better suggestions. BDRV_O_LIMITED_USE?
BDRV_O_HANDOFF? At any rate, I fully agree with your logic of locking
things down on the source to mark that the destination is about to take
over write access to the file.
>
> 3. One side (the destination on success) continues and calls
> bdrv_invalidate_all() in order to take ownership of the image again.
> This removes BDRV_O_INCOMING on the resuming side; the flag remains
> set on the other side.
>
> This ensures that the same image isn't written to by both instances
> (unless both are resumed, but then you get what you deserve). This is
> important because .bdrv_close for non-BDRV_O_INCOMING images could write
> to the image file, which is definitely forbidden while another host is
> using the image.
And indeed, this is a prereq to your patch that modifies the file on
close to clear the new 'open-for-writing' flag :)
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> block.c | 34 ++++++++++++++++++++++++++++++++++
> include/block/block.h | 1 +
> include/block/block_int.h | 1 +
> migration/migration.c | 7 +++++++
> qmp.c | 12 ++++++++++++
> 5 files changed, 55 insertions(+)
>
> @@ -1536,6 +1540,9 @@ static void migration_completion(MigrationState *s, int current_active_state,
> if (!ret) {
> ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
> if (ret >= 0) {
> + ret = bdrv_inactivate_all();
> + }
> + if (ret >= 0) {
> qemu_file_set_rate_limit(s->file, INT64_MAX);
Isn't the point of the rate limit change to allow any pending operations
to flush without artificial slow limits? Will inactivating the device
be too slow if rate limits are still slow?
But offhand, I don't have any strong proof that a different order is
required, so yours makes sense to me.
You may want a second opinion, but I'm okay if you add:
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2015-12-22 20:43 UTC|newest]
Thread overview: 99+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-22 16:46 [Qemu-devel] [PATCH 00/10] qcow2: Implement image locking Kevin Wolf
2015-12-22 16:46 ` [Qemu-devel] [PATCH 01/10] qcow2: Write feature table only for v3 images Kevin Wolf
2015-12-22 20:20 ` Eric Blake
2016-01-11 15:20 ` Kevin Wolf
2015-12-22 16:46 ` [Qemu-devel] [PATCH 02/10] qcow2: Write full header on image creation Kevin Wolf
2015-12-22 20:25 ` Eric Blake
2015-12-22 16:46 ` [Qemu-devel] [PATCH 03/10] block: Assert no write requests under BDRV_O_INCOMING Kevin Wolf
2015-12-22 20:27 ` Eric Blake
2015-12-22 16:46 ` [Qemu-devel] [PATCH 04/10] block: Fix error path in bdrv_invalidate_cache() Kevin Wolf
2015-12-22 20:31 ` Eric Blake
2015-12-22 16:46 ` [Qemu-devel] [PATCH 05/10] block: Inactivate BDS when migration completes Kevin Wolf
2015-12-22 20:43 ` Eric Blake [this message]
2016-01-05 20:21 ` [Qemu-devel] [Qemu-block] " John Snow
2016-01-13 14:25 ` Kevin Wolf
2016-01-13 16:35 ` Eric Blake
2015-12-22 16:46 ` [Qemu-devel] [PATCH 06/10] qemu-img: Prepare for locked images Kevin Wolf
2015-12-22 16:57 ` Daniel P. Berrange
2015-12-22 17:00 ` Kevin Wolf
2015-12-22 21:06 ` Eric Blake
2016-01-11 15:49 ` Markus Armbruster
2016-01-11 16:05 ` Kevin Wolf
2016-01-12 15:20 ` Markus Armbruster
2016-01-12 17:36 ` Kevin Wolf
2016-01-13 8:44 ` Markus Armbruster
2016-01-13 14:19 ` Kevin Wolf
2016-01-14 13:07 ` Markus Armbruster
2016-01-14 14:19 ` Kevin Wolf
2016-01-11 16:22 ` Kevin Wolf
2015-12-22 21:41 ` Eric Blake
2015-12-22 16:46 ` [Qemu-devel] [PATCH 07/10] qcow2: Implement .bdrv_inactivate Kevin Wolf
2015-12-22 21:17 ` Eric Blake
2016-01-11 15:34 ` Kevin Wolf
2015-12-22 16:46 ` [Qemu-devel] [PATCH 08/10] qcow2: Fix BDRV_O_INCOMING handling in qcow2_invalidate_cache() Kevin Wolf
2015-12-22 21:22 ` Eric Blake
2015-12-22 16:46 ` [Qemu-devel] [PATCH 09/10] qcow2: Make image inaccessible after failed qcow2_invalidate_cache() Kevin Wolf
2015-12-22 21:24 ` Eric Blake
2015-12-22 16:46 ` [Qemu-devel] [PATCH 10/10] qcow2: Add image locking Kevin Wolf
2015-12-22 22:04 ` Eric Blake
2015-12-23 3:14 ` [Qemu-devel] [PATCH 00/10] qcow2: Implement " Fam Zheng
2015-12-23 7:35 ` [Qemu-devel] [Qemu-block] " Denis V. Lunev
2015-12-23 7:46 ` [Qemu-devel] [PATCH RFC 0/5] generic image locking and crash recovery Denis V. Lunev
2015-12-23 7:46 ` [Qemu-devel] [PATCH 1/5] block: added lock image option and callback Denis V. Lunev
2015-12-23 23:48 ` Eric Blake
2016-01-11 17:31 ` Kevin Wolf
2016-01-11 17:58 ` Daniel P. Berrange
2016-01-11 18:35 ` Kevin Wolf
2016-01-13 8:52 ` Markus Armbruster
2016-01-13 9:12 ` Denis V. Lunev
2016-01-13 9:50 ` Daniel P. Berrange
2016-01-13 9:51 ` Daniel P. Berrange
2016-01-12 5:38 ` Denis V. Lunev
2016-01-12 10:10 ` Kevin Wolf
2016-01-12 11:33 ` Fam Zheng
2016-01-12 12:24 ` Denis V. Lunev
2016-01-12 12:28 ` Kevin Wolf
2016-01-12 13:17 ` Fam Zheng
2016-01-12 13:24 ` Daniel P. Berrange
2016-01-13 0:08 ` Fam Zheng
2016-01-12 15:59 ` Denis V. Lunev
2016-01-13 0:10 ` Fam Zheng
2016-01-13 16:44 ` Eric Blake
2016-01-14 7:23 ` Denis V. Lunev
2015-12-23 7:46 ` [Qemu-devel] [PATCH 2/5] block: implemented bdrv_lock_image for raw file Denis V. Lunev
2015-12-23 12:40 ` Daniel P. Berrange
2015-12-23 7:46 ` [Qemu-devel] [PATCH 3/5] block: added check image option and callback bdrv_is_opened_unclean Denis V. Lunev
2015-12-23 9:09 ` Fam Zheng
2015-12-23 9:14 ` Denis V. Lunev
2015-12-23 7:46 ` [Qemu-devel] [PATCH 4/5] qcow2: implemented bdrv_is_opened_unclean Denis V. Lunev
2016-01-11 17:37 ` Kevin Wolf
2015-12-23 7:46 ` [Qemu-devel] [PATCH 5/5] block/paralels: added paralles implementation for bdrv_is_opened_unclean Denis V. Lunev
2015-12-23 8:09 ` [Qemu-devel] [PATCH RFC 0/5] generic image locking and crash recovery Fam Zheng
2015-12-23 8:36 ` Denis V. Lunev
2015-12-23 10:47 ` [Qemu-devel] [PATCH 00/10] qcow2: Implement image locking Daniel P. Berrange
2015-12-23 12:15 ` [Qemu-devel] [Qemu-block] " Roman Kagan
2015-12-23 12:29 ` Daniel P. Berrange
2015-12-23 12:41 ` Denis V. Lunev
2015-12-23 12:46 ` Daniel P. Berrange
2015-12-23 12:34 ` Daniel P. Berrange
2015-12-23 12:47 ` Denis V. Lunev
2015-12-23 12:56 ` Daniel P. Berrange
2016-01-11 17:14 ` [Qemu-devel] " Kevin Wolf
2016-01-11 17:54 ` Daniel P. Berrange
2016-01-13 8:56 ` Markus Armbruster
2016-01-13 9:11 ` [Qemu-devel] [Qemu-block] " Denis V. Lunev
2015-12-23 23:19 ` [Qemu-devel] " Max Reitz
2015-12-24 5:41 ` [Qemu-devel] [Qemu-block] " Denis V. Lunev
2015-12-24 5:42 ` Denis V. Lunev
2016-01-04 17:02 ` Max Reitz
2016-01-11 16:47 ` Kevin Wolf
2016-01-11 17:56 ` Daniel P. Berrange
2015-12-23 14:57 ` [Qemu-devel] " Vasiliy Tolstov
2015-12-23 15:08 ` [Qemu-devel] [Qemu-block] " Denis V. Lunev
2015-12-23 15:11 ` Vasiliy Tolstov
2016-01-11 16:25 ` Kevin Wolf
2015-12-23 15:09 ` Denis V. Lunev
2015-12-24 5:43 ` Denis V. Lunev
2016-01-11 16:33 ` Kevin Wolf
2016-01-11 16:38 ` Denis V. Lunev
2016-01-14 14:01 ` 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=5679B5DE.5070205@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).