From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] Review of ways to reopen BDSes (was: Review of monitor commands identifying BDS / BB by name)
Date: Fri, 19 Dec 2014 16:52:16 +0100 [thread overview]
Message-ID: <87sigb1vtb.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <87vbltvpl0.fsf@blackfin.pond.sub.org> (Markus Armbruster's message of "Tue, 02 Dec 2014 20:06:35 +0100")
= Introduction =
Kevin asked for all the ways you can reopen BDSes with different options
or flags. This memo only covers all the ways you can reopen, but it
doesn't attempt to fully analyze how options or flags change in each
case.
This is a systematic review of all the ways you can reopen BDSes in qemu
proper, i.e. not in qemu-{img,io,nbd}. I tracked them down by following
the call chains leading to bdrv_reopen_multiple().
= QMP commands =
* block-commit
Two separate code paths, depending on whether we're it's an active
layer commit or not.
- If active, we reopen the base with the root's flags. If we fail
later during start, we try to restore the flags by reopening again.
In theory, restoring can fail, and then we mess up the flags.
Avoiding that would be nice.
The actual commit is done by code shared with drive-mirror, covered
below.
- Else, we reopen both the base and the overlay read/write. The
overlay is the BDS that has the top as backing file. If we fail
later during start, we don't attempt to undo a change to read/write,
as far as I can tell. Looks like a bug.
On completion, we do attempt to undo, by reopening them again with
their original flags.
* blockdev-snapshot-sync
Creating an external snapshot of a node means splicing in a new
snapshot BDS with the node as backing file. We then try to reopen the
node readonly, because it's now a backing file. Failure is ignored,
i.e. the node simply remains as writable as before.
* change-backing-file
This updates the backing file in the image. If the BDS is read-only,
we reopen read/write before, and reopen read-only after. If the first
reopen fails, the command fails without doing anything. If the update
fails, we try the second reopen before failing the command with the
failed update's error. If the second reopen fails (unlikely), the
command fails in an ugly way: the BDS is left writable. Avoiding that
would be nice.
* drive-mirror
On successful completion, we do some BDS rewiring I don't fully
understand. The mirror target BDS gets swapped into another BDS. If
the two have different flags, we reopen the target to make them the
same before we swap. An explanation of what happens here is welcome.
* transaction
This is a wrapper around a list of transaction-capable commands.
Thus, nothing new here.
= Other user interfaces =
* HMP command commit
Less capable cousin of QMP command block-commit. Should be
implemented on top of QMP, but isn't. Instead, we a separate,
specialized duplicate of the general commit code: bdrv_commit().
* Console escape key 's'
Like HMP command "commit all". See mux_proc_byte().
Public service announcement: don't name your block backends "all".
* HMP command drive_mirror
Implemented on top of QMP, so nothing new here.
= Generic block layer =
bdrv_reopen_queue() collects BDSes for atomic reopen,
bdrv_reopen_multiple() actually does it, in two stages,
bdrv_reopen_prepare() and bdrv_reopen_commit() / bdrv_reopen_abort().
All three call block driver methods with the same name.
bdrv_reopen() is a convenience wrapper for reopening a single BDS.
= Block driver methods =
Only one of them recurses:
* vmdk_reopen_prepare()
Queues the extents. Necessary, because the block driver hides them
from the generic block layer. Needs work, see also "Review of ways to
create BDSes".
prev parent reply other threads:[~2014-12-19 15:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-02 19:06 [Qemu-devel] Review of monitor commands identifying BDS / BB by name Markus Armbruster
2014-12-03 5:52 ` Fam Zheng
2014-12-03 11:13 ` Paolo Bonzini
2014-12-04 15:59 ` Markus Armbruster
2014-12-03 10:30 ` Kevin Wolf
2014-12-03 13:59 ` Eric Blake
2014-12-03 14:51 ` Markus Armbruster
2014-12-04 16:56 ` Markus Armbruster
2014-12-04 15:56 ` Markus Armbruster
2014-12-04 19:44 ` Eric Blake
2014-12-05 9:19 ` Kevin Wolf
2014-12-05 12:19 ` Markus Armbruster
2014-12-05 9:34 ` Markus Armbruster
2014-12-05 9:46 ` Kevin Wolf
2014-12-05 12:08 ` Markus Armbruster
2014-12-16 18:12 ` [Qemu-devel] Can we make monitor commands identify BDS / BB by name consistently? (was: Review of monitor commands identifying BDS / BB by name) Markus Armbruster
2014-12-17 14:12 ` Kevin Wolf
2014-12-17 16:17 ` [Qemu-devel] Can we make monitor commands identify BDS / BB by name consistently? Markus Armbruster
2014-12-19 18:27 ` Markus Armbruster
2014-12-18 15:25 ` [Qemu-devel] Review of ways to create BDSes (was: Review of monitor commands identifying BDS / BB by name) Markus Armbruster
2014-12-19 12:18 ` Kevin Wolf
2014-12-19 14:02 ` [Qemu-devel] Review of ways to create BDSes Markus Armbruster
2014-12-19 14:24 ` Markus Armbruster
2014-12-19 15:52 ` Markus Armbruster [this message]
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=87sigb1vtb.fsf@blackfin.pond.sub.org \
--to=armbru@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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 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.