qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: "Benoît Canet" <benoit.canet@irqsave.net>
Cc: kwolf@redhat.com, Benoit Canet <benoit@irqsave.net>,
	qemu-devel@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH v5 2/3] block: Add drive-mirror-replace command
Date: Fri, 6 Jun 2014 17:57:17 +0200	[thread overview]
Message-ID: <20140606155717.GA25089@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1401448724-27851-3-git-send-email-benoit.canet@irqsave.net>

[-- Attachment #1: Type: text/plain, Size: 2043 bytes --]

On Fri, May 30, 2014 at 01:18:43PM +0200, Benoît Canet wrote:
> When a quorum file is totally destroyed (broken NAS or SAN) the user can start a
> drive-mirror job on the quorum block backend and then replace the broken
> quorum file with drive-mirror-replace given it has a node-name.
> 
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---
>  block.c                   |   8 ++--
>  block/mirror.c            | 118 ++++++++++++++++++++++++++++++++++++++++++++--
>  blockdev.c                |  27 +++++++++++
>  include/block/block.h     |   3 ++
>  include/block/block_int.h |  15 ++++++
>  qapi-schema.json          |  33 +++++++++++++
>  qmp-commands.hx           |   5 ++
>  trace-events              |   1 +
>  8 files changed, 204 insertions(+), 6 deletions(-)

The drive-mirror-replace command is just block-job-complete plus
stashing arguments away.  I think the approach you took in v1 was
simpler: add an argument to drive-mirror and don't introduce new QAPI
commands.

There was discussion of a generic swap command, but drive-mirror-replace
is not generic.

Please revert to the drive-mirror argument approach since the
drive-mirror + block-job-complete API is sufficient to implement this
behavior.

> @@ -502,6 +518,11 @@ immediate_exit:
>              bdrv_unref(p);
>          }
>      }
> +    if (s->must_replace) {
> +        bdrv_op_unblock_all(s->to_replace, s->replace_blocker);
> +        error_free(s->replace_blocker);
> +        bdrv_unref(s->to_replace);
> +    }
>      bdrv_unref(s->target);
>      block_job_completed(&s->common, ret);
>  }

Can we do this unconditionally on the to_replace target (s->common.bs or
user-defined BDS)?  This code is already fairly complex and it's nice to
avoid more conditionals.

The swap operation is really the same whether to_replace == s->common.bs
or a user-defined BDS.  The op blocker cleanup and unref could be
unconditional as long as we op block and ref s->common.bs when no
user-defined BDS was given.

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

      parent reply	other threads:[~2014-06-06 15:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1401448724-27851-1-git-send-email-benoit.canet@irqsave.net>
     [not found] ` <1401448724-27851-2-git-send-email-benoit.canet@irqsave.net>
2014-06-02 15:34   ` [Qemu-devel] [PATCH v5 1/3] quorum: Add the rewrite-corrupted parameter to quorum Stefan Hajnoczi
2014-06-03  9:14   ` Kevin Wolf
     [not found] ` <1401448724-27851-3-git-send-email-benoit.canet@irqsave.net>
2014-06-04 11:07   ` [Qemu-devel] [PATCH v5 2/3] block: Add drive-mirror-replace command Benoît Canet
2014-06-06 15:57   ` Stefan Hajnoczi [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=20140606155717.GA25089@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=benoit.canet@irqsave.net \
    --cc=benoit@irqsave.net \
    --cc=kwolf@redhat.com \
    --cc=mreitz@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).