From: Eric Blake <eblake@redhat.com>
To: Jeff Cody <jcody@redhat.com>
Cc: kwolf@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 2/7] block: add live block commit functionality
Date: Tue, 25 Sep 2012 12:12:47 -0600 [thread overview]
Message-ID: <5061F41F.4080502@redhat.com> (raw)
In-Reply-To: <1efc2c8c9b7c215b787507afa5a34c0175f7f4f0.1348589526.git.jcody@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2834 bytes --]
On 09/25/2012 10:29 AM, Jeff Cody wrote:
> This adds the live commit coroutine. This iteration focuses on the
> commit only below the active layer, and not the active layer itself.
>
> The behaviour is similar to block streaming; the sectors are walked
> through, and anything that exists above 'base' is committed back down
> into base. At the end, intermediate images are deleted, and the
> chain stitched together. Images are restored to their original open
> flags upon completion.
>
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> +void commit_start(BlockDriverState *bs, BlockDriverState *base,
> + BlockDriverState *top, int64_t speed,
> + BlockErrorAction on_error, BlockDriverCompletionFunc *cb,
> + void *opaque, Error **errp)
> +{
> + CommitBlockJob *s;
> + BlockReopenQueue *reopen_queue = NULL;
> + int orig_overlay_flags;
> + int orig_base_flags;
> + BlockDriverState *overlay_bs;
> + Error *local_err = NULL;
> +
> + if ((on_error == BLOCK_ERR_STOP_ANY ||
> + on_error == BLOCK_ERR_STOP_ENOSPC) &&
> + !bdrv_iostatus_is_enabled(bs)) {
> + error_set(errp, QERR_INVALID_PARAMETER_COMBINATION);
> + return;
> + }
> +
> + overlay_bs = bdrv_find_overlay(bs, top);
> +
> + if (overlay_bs == NULL) {
> + error_setg(errp, "Could not find overlay image for %s:", top->filename);
> + return;
> + }
> +
> + orig_base_flags = bdrv_get_flags(base);
> + orig_overlay_flags = bdrv_get_flags(overlay_bs);
I think you are missing a check here that base is on the backing chain
of top. See also my comments to 5/7.
> +
> + /* convert base_bs & overlay_bs to r/w, if necessary */
> + if (!(orig_base_flags & BDRV_O_RDWR)) {
> + reopen_queue = bdrv_reopen_queue(reopen_queue, base,
> + orig_base_flags | BDRV_O_RDWR);
> + }
> + if (!(orig_overlay_flags & BDRV_O_RDWR)) {
> + reopen_queue = bdrv_reopen_queue(reopen_queue, overlay_bs,
> + orig_overlay_flags | BDRV_O_RDWR);
> + }
> + if (reopen_queue) {
> + bdrv_reopen_multiple(reopen_queue, &local_err);
Is it valid to make a no-op call, such as:
{ "execute":"block-commit", "arguments":{
"device":"drive0", "top":"base", "base":"base" }}
If so, should we do an early exit here, rather than temporarily changing
base to R/W just to change it back to R/O?
If not, should we be rejecting it up front (again, back to the question
of failing if 'base' is not a backing file of 'top', even if both 'top'
and 'base' are backing files of 'device').
--
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: 617 bytes --]
next prev parent reply other threads:[~2012-09-25 18:12 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-25 16:29 [Qemu-devel] [PATCH v2 0/7] Live block commit Jeff Cody
2012-09-25 16:29 ` [Qemu-devel] [PATCH v2 1/7] block: add support functions for live commit, to find and delete images Jeff Cody
2012-09-26 13:53 ` Kevin Wolf
2012-09-25 16:29 ` [Qemu-devel] [PATCH v2 2/7] block: add live block commit functionality Jeff Cody
2012-09-25 18:12 ` Eric Blake [this message]
2012-09-25 18:58 ` Jeff Cody
2012-09-25 19:05 ` Eric Blake
2012-09-26 14:03 ` Kevin Wolf
2012-09-25 16:29 ` [Qemu-devel] [PATCH v2 3/7] blockdev: rename block_stream_cb to a generic block_job_cb Jeff Cody
2012-09-25 16:29 ` [Qemu-devel] [PATCH v2 4/7] block: helper function, to find the base image of a chain Jeff Cody
2012-09-25 19:13 ` Eric Blake
2012-09-25 19:45 ` Jeff Cody
2012-09-25 16:29 ` [Qemu-devel] [PATCH v2 5/7] QAPI: add command for live block commit, 'block-commit' Jeff Cody
2012-09-25 19:42 ` Eric Blake
2012-09-25 19:57 ` Jeff Cody
2012-09-26 14:13 ` Kevin Wolf
2012-09-26 14:25 ` Jeff Cody
2012-09-26 14:33 ` Kevin Wolf
2012-09-26 14:34 ` Eric Blake
2012-09-25 16:29 ` [Qemu-devel] [PATCH v2 6/7] qemu-iotests: add initial tests for live block commit Jeff Cody
2012-09-25 18:02 ` Eric Blake
2012-09-25 18:53 ` Jeff Cody
2012-09-25 16:29 ` [Qemu-devel] [PATCH v2 7/7] block: after creating a live snapshot, make old image read-only Jeff Cody
2012-09-26 14:20 ` Kevin Wolf
2012-09-26 14:21 ` Jeff Cody
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=5061F41F.4080502@redhat.com \
--to=eblake@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--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).