From: Kevin Wolf <kwolf@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: qemu-block@nongnu.org, pbonzini@redhat.com, jcody@redhat.com,
Ciprian.Barbu@enea.com, Alexandru.Avadanii@enea.com,
armband@enea.com, eblake@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH for-2.9] block: Ignore guest dev permissions during incoming migration
Date: Thu, 6 Apr 2017 13:22:56 +0200 [thread overview]
Message-ID: <20170406112256.GF4341@noname.redhat.com> (raw)
In-Reply-To: <d74fad45-9f89-6f34-020f-87e6b20ea59b@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3094 bytes --]
Am 05.04.2017 um 15:22 hat Max Reitz geschrieben:
> On 04.04.2017 17:35, Kevin Wolf wrote:
> > Usually guest devices don't like other writers to the same image, so
> > they use blk_set_perm() to prevent this from happening. In the migration
> > phase before the VM is actually running, though, they don't have a
> > problem with writes to the image. On the other hand, storage migration
> > needs to be able to write to the image in this phase, so the restrictive
> > blk_set_perm() call of qdev devices breaks it.
> >
> > This patch flags all BlockBackends with a qdev device as
> > blk->disable_perm during incoming migration, which means that the
> > requested permissions are stored in the BlockBackend, but not actually
> > applied to its root node yet.
> >
> > Once migration has finished and the VM should be resumed, the
> > permissions are applied. If they cannot be applied (e.g. because the NBD
> > server used for block migration hasn't been shut down), resuming the VM
> > fails.
> >
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> > block/block-backend.c | 40 +++++++++++++++++++++++++++++++++++++++-
> > include/block/block.h | 2 ++
> > migration/migration.c | 8 ++++++++
> > qmp.c | 6 ++++++
> > 4 files changed, 55 insertions(+), 1 deletion(-)
> >
> > diff --git a/block/block-backend.c b/block/block-backend.c
> > index 0b63773..f817040 100644
> > --- a/block/block-backend.c
> > +++ b/block/block-backend.c
>
> [...]
>
> > @@ -597,15 +598,52 @@ void blk_get_perm(BlockBackend *blk, uint64_t *perm, uint64_t *shared_perm)
> > *shared_perm = blk->shared_perm;
> > }
> >
> > +/*
> > + * Notifies the user of all BlockBackends that migration has completed. qdev
> > + * devices can tighten their permissions in response (specifically revoke
> > + * shared write permissions that we needed for storage migration).
> > + *
> > + * If an error is returned, the VM cannot be allowed to be resumed.
> > + */
> > +void blk_resume_after_migration(Error **errp)
> > +{
> > + BlockBackend *blk;
> > + Error *local_err = NULL;
> > +
> > + for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
>
> Shouldn't we use blk_all_next()?
Good catch, thanks.
At first I added it into the loop in qmp_cont() and then copied it here
without noticing the resetting the iostatus is really only needed for
monitor-owned BBs at the moment, but this one is different.
Of course, as soon as we improve query-block to work reasonably well
with -device drive=<node-name>, qmp_cont() needs to use blk_all_next(),
too.
> Trusting you that silently disabling autostart is something the upper
> layers can deal with, the rest looks good to me.
>
> (The only other runtime changes of autostart apart from stop/cont appear
> to be in blockdev_init() (if (bdrv_key_required()), but I don't think
> that can happen anymore) and in migration/colo.c (which enables it and
> emits an error message).)
I think in practice libvirt always sets -S on the destination anyway.
Kevin
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2017-04-06 11:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-04 15:35 [Qemu-devel] [RFC PATCH for-2.9] block: Ignore guest dev permissions during incoming migration Kevin Wolf
2017-04-05 13:22 ` Max Reitz
2017-04-06 11:22 ` Kevin Wolf [this message]
2017-04-06 11:31 ` Daniel P. Berrange
2017-04-06 11:15 ` Kevin Wolf
2017-04-06 17:16 ` [Qemu-devel] [Qemu-block] " Kashyap Chamarthy
2017-04-06 17:26 ` Kashyap Chamarthy
2017-04-06 18:46 ` Kashyap Chamarthy
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=20170406112256.GF4341@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=Alexandru.Avadanii@enea.com \
--cc=Ciprian.Barbu@enea.com \
--cc=armband@enea.com \
--cc=eblake@redhat.com \
--cc=jcody@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.