From: Eric Blake <eblake@redhat.com>
To: Jeff Cody <jcody@redhat.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, benoit.canet@irqsave.net, pkrempa@redhat.com,
famz@redhat.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v4 05/10] block: Accept node-name arguments for block-commit
Date: Wed, 04 Jun 2014 15:38:55 -0600 [thread overview]
Message-ID: <538F91EF.2010700@redhat.com> (raw)
In-Reply-To: <5da6a0b4d7cf0177bb5bf8e2e74a49769d90120c.1401886089.git.jcody@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2861 bytes --]
On 06/04/2014 07:51 AM, Jeff Cody wrote:
> This modifies the block operation block-commit so that it will
> accept node-name arguments for either 'top' or 'base' BDS.
>
> The filename and node-name are mutually exclusive to each other;
> i.e.:
> "top" and "top-node-name" are mutually exclusive (enforced)
> "base" and "base-node-name" are mutually exclusive (enforced)
>
> The "device" argument now becomes optional as well, because with
> a node-name we can identify the block device chain. It is only
> optional if a node-name is not specified.
Stale paragraph; just delete it. [We may later want to add patches to
make device optional, if we can figure out a solution for what to do
when a BDS has more than one overlay; but that doesn't need to stall
this series]
>
> The preferred and recommended method now of using block-commit
> is to specify the BDS to operate on via their node-name arguments.
>
> This also adds an explicit check that base_bs is in the chain of
> top_bs, because if they are referenced by their unique node-name
> arguments, the discovery process does not intrinsically verify
> they are in the same chain.
>
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> ---
> blockdev.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++--------
> qapi-schema.json | 37 +++++++++++++++++++++++++++----------
> qmp-commands.hx | 31 +++++++++++++++++++++++--------
> 3 files changed, 97 insertions(+), 26 deletions(-)
>
> - bs = bdrv_find(device);
> - if (!bs) {
> - error_set(errp, QERR_DEVICE_NOT_FOUND, device);
> + /* argument combination validation */
> + if (has_base && has_base_node_name) {
> + error_setg(errp, "'base' and 'base-node-name' are mutually exclusive");
> + return;
> + }
An alternative would have been to validate that both 'base' and
'base-node-name' resolve to the same BDS, but I like the simplicity of
erroring out here.
> +
> + if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_COMMIT, errp)) {
> + return;
> + }
[unrelated to this commit - are we sure that the semantics of the commit
blocker are correct? If we implement BDS reuse among multiple chains,
consider what happens if I have:
/ sn1 <- sn2
base <
\ file3
Even if there is no other block job operating on sn2 or its chain, we
really want to block an attempt to merge file3 into base, as modifying
base would corrupt both sn1 and sn2. That is, a BDS being a common
backing between more than one chain should automatically behave as an
op-blocker for commits - where the block is what you are committing
into, not where you are committing from.]
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:[~2014-06-04 21:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-04 13:51 [Qemu-devel] [PATCH v4 00/10] Modify block jobs to use node-names Jeff Cody
2014-06-04 13:51 ` [Qemu-devel] [PATCH v4 01/10] block: Auto-generate node_names for each BDS entry Jeff Cody
2014-06-04 13:51 ` [Qemu-devel] [PATCH v4 02/10] block: add helper function to determine if a BDS is in a chain Jeff Cody
2014-06-04 13:51 ` [Qemu-devel] [PATCH v4 03/10] block: simplify bdrv_find_base() and bdrv_find_overlay() Jeff Cody
2014-06-04 19:45 ` Eric Blake
2014-06-04 13:51 ` [Qemu-devel] [PATCH v4 04/10] block: make 'top' argument to block-commit optional Jeff Cody
2014-06-04 20:59 ` Eric Blake
2014-06-05 0:26 ` Jeff Cody
2014-06-04 13:51 ` [Qemu-devel] [PATCH v4 05/10] block: Accept node-name arguments for block-commit Jeff Cody
2014-06-04 21:38 ` Eric Blake [this message]
2014-06-05 0:57 ` Jeff Cody
2014-06-04 13:51 ` [Qemu-devel] [PATCH v4 06/10] block: extend block-commit to accept a string for the backing file Jeff Cody
2014-06-04 13:51 ` [Qemu-devel] [PATCH v4 07/10] block: add ability for block-stream to use node-name Jeff Cody
2014-06-05 2:22 ` Eric Blake
2014-06-04 13:51 ` [Qemu-devel] [PATCH v4 08/10] block: add backing-file option to block-stream Jeff Cody
2014-06-04 13:51 ` [Qemu-devel] [PATCH v4 09/10] block: Add QMP documentation for block-stream Jeff Cody
2014-06-04 13:51 ` [Qemu-devel] [PATCH v4 10/10] block: add QAPI command to allow live backing file change Jeff Cody
2014-06-05 2:38 ` Eric Blake
2014-06-05 11:53 ` Benoît Canet
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=538F91EF.2010700@redhat.com \
--to=eblake@redhat.com \
--cc=benoit.canet@irqsave.net \
--cc=famz@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=pkrempa@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 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).