All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: kwolf@redhat.com, Jeff Cody <jcody@redhat.com>,
	mtosatti@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com,
	Federico Simoncelli <fsimonce@redhat.com>
Subject: [Qemu-devel] drive transactions (was Re: [PATCH 2/2 v2] Add the blockdev-reopen and blockdev-migrate commands)
Date: Mon, 27 Feb 2012 15:39:33 +0100	[thread overview]
Message-ID: <4F4B95A5.3000804@redhat.com> (raw)
In-Reply-To: <20120227100645.3f36d52d@doriath.home>

On 02/27/2012 02:06 PM, Luiz Capitulino wrote:
> IMHO, this is asking for two commands, where cases 1 & 2 is one of them
> and cases 3 & 4 is the other one. Note how 'incremental' goes away and
> 'new_image_file' really becomes an optional.

I really would have no idea on naming except perhaps "drive_migrate" and
"funny_drive_migrate_for_ovirt".  But actually I must admit that it's a
rat's nest.

First, there's no reason why live-snapshotting to new_image_file
shouldn't be handled within QEMU.  That would make the above table much
more orthogonal.  However, oVirt likes to create its own snapshots.

Perhaps we do need to rethink this together with group snapshots.

There are four kinds of operations that we do on block devices:
(a) create an image.  This is part of what blockdev-snapshot does.
(b) switch a block device to a new image.  drive-reopen does this.
(c) add mirroring to a new destination.
(d) activate streaming from a base image

drive-migrate does (b) and (c), will do (a) and (d) when we add
pre-copy, and should do (a) right now if Federico wasn't an oVirt
developer. :)

Thinking more about it, the commands we _do_ need are:
- start a transaction
- switch to a new image
- add mirroring to a new destination
- commit a transaction
- rollback a transaction
- query transaction errors

Creating an image can be done outside a transaction for now because we
only support live external snapshots.  Streaming can also be started
outside a transaction, because it doesn't need to be started atomically.

If we have the above elementary commands, blockdev-snapshot-sync becomes
sugar for this:

    (create image)
    blockdev-start-transaction if no active transaction
    drive-reopen
    blockdev-commit-transaction if no active transaction

Jeff's group snapshot can be realized as this:

    blockdev-begin-transaction
    blockdev-snapshot-sync
    ...
    blockdev-snapshot-sync
    blockdev-commit-transaction

And for drive-migrate, let's look at the above 3 cases:

> > 1) incremental=false, new_image_file not passed:
> >    right now fail; in the future:
> >    - create an image on dest with no backing file;
> >    - writes will be mirrored to current_image_file and dest
> >    - start streaming from current_image_file to dest

This is a new command "drive-mirror device dest", which does:

    (create image for dest)
    blockdev-begin-transaction if no active transaction
    drive-mirror device dest
    blockdev-commit-transaction if no active transaction

The command does this:

- mirror writes to current_image_file and dest
- start streaming from current_image_file to dest

The second part can be suppressed with a boolean argument.

> > 2) incremental=false, new_image_file passed:
> >    right now fail; in the future:
> >    - create an image on dest with no backing file;
> >    - live-snapshot based on current_image_file to new_image_file;
> >    - writes will be mirrored to new_image_file and dest
> >    - start streaming from current_image_file to dest

Atomicity is not needed here, so the user can simply issue:

    blockdev-snapshot-sync device new-image-file
    drive-mirror device dest

> > 4) incremental=true, new_image_file passed:
> >    - no images will be created
> >    - writes will be mirrored to new_image_file and dest

No need to provide this from within QEMU, because libvirt/oVirt can do
the dance using elementary operations:

    blockdev-begin-transaction
    drive-reopen device new-image-file
    drive-mirror streaming=false device dest
    blockdev-commit-transaction

No strange optional arguments, no proliferation of commands, etc.  The
only downside is that if someone tries to do (4) without transactions
(or without stopping the VM) they'll get corruption because atomicity is
required.

Paolo

  reply	other threads:[~2012-02-27 14:39 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-22 17:13 [Qemu-devel] Live Block Migration using Mirroring Federico Simoncelli
2012-02-22 17:13 ` [Qemu-devel] [PATCH 1/3] Add blkmirror block driver Federico Simoncelli
2012-02-23 16:14   ` Stefan Hajnoczi
2012-02-23 16:18     ` Stefan Hajnoczi
2012-02-23 16:20       ` Federico Simoncelli
2012-02-23 16:28         ` Stefan Hajnoczi
2012-02-23 16:51           ` Federico Simoncelli
2012-02-23 16:18     ` Federico Simoncelli
2012-02-27  9:23     ` Stefan Hajnoczi
2012-02-27 11:37       ` Paolo Bonzini
2012-02-27 11:42         ` Stefan Hajnoczi
2012-02-27 11:48           ` Paolo Bonzini
2012-02-27 13:09             ` Stefan Hajnoczi
2012-02-27 13:47               ` Paolo Bonzini
2012-02-27 14:49                 ` Stefan Hajnoczi
2012-02-27 14:59                   ` Stefan Hajnoczi
2012-02-27 15:08                     ` Paolo Bonzini
2012-02-22 17:13 ` [Qemu-devel] [PATCH 2/3] Update the " Federico Simoncelli
2012-02-23  7:18   ` Paolo Bonzini
2012-02-23  9:44     ` Federico Simoncelli
2012-02-23  9:45       ` Paolo Bonzini
2012-02-22 17:13 ` [Qemu-devel] [PATCH 3/3] Add nocreate option to snapshot_blkdev Federico Simoncelli
2012-02-23  7:19   ` Paolo Bonzini
2012-02-23  7:38     ` Paolo Bonzini
2012-02-23  9:39       ` Federico Simoncelli
2012-02-23  9:48         ` Paolo Bonzini
2012-02-23 10:19           ` Federico Simoncelli
2012-02-23 11:30             ` Paolo Bonzini
2012-02-23 15:47 ` [Qemu-devel] Live Block Migration using Mirroring Stefan Hajnoczi
2012-02-23 16:10   ` Federico Simoncelli
2012-02-23 16:35 ` Stefan Hajnoczi
2012-02-23 17:06   ` Federico Simoncelli
2012-02-24 11:37 ` [Qemu-devel] [PATCH 1/2] Add blkmirror block driver Federico Simoncelli
2012-02-24 11:37 ` [Qemu-devel] [PATCH 2/2] Add the blockdev-reopen and blockdev-migrate commands Federico Simoncelli
2012-02-24 12:03   ` Kevin Wolf
2012-02-24 12:12     ` Federico Simoncelli
2012-02-24 13:11     ` Paolo Bonzini
2012-02-24 17:04     ` Luiz Capitulino
2012-02-27 14:57     ` Markus Armbruster
2012-02-24 16:49 ` [Qemu-devel] [PATCH 1/2 v2] Add blkmirror block driver Federico Simoncelli
2012-02-24 17:02   ` Eric Blake
2012-02-24 17:15     ` Federico Simoncelli
2012-02-24 18:49     ` Paolo Bonzini
2012-02-24 18:17   ` Luiz Capitulino
2012-02-27  9:17     ` Federico Simoncelli
2012-02-24 16:49 ` [Qemu-devel] [PATCH 2/2 v2] Add the blockdev-reopen and blockdev-migrate commands Federico Simoncelli
2012-02-24 17:46   ` Eric Blake
2012-02-24 18:57     ` Paolo Bonzini
2012-02-24 19:37       ` Eric Blake
2012-02-24 19:01   ` Luiz Capitulino
2012-02-24 19:40     ` Eric Blake
2012-02-24 20:26       ` Luiz Capitulino
2012-02-24 22:46         ` Eric Blake
2012-02-24 20:32     ` Paolo Bonzini
2012-02-24 20:36       ` Luiz Capitulino
2012-02-24 21:05         ` Paolo Bonzini
2012-02-24 22:30     ` Eric Blake
2012-02-25  6:47       ` Paolo Bonzini
2012-02-27 11:29     ` Federico Simoncelli
2012-02-27 12:12       ` Luiz Capitulino
2012-02-27 12:49         ` Paolo Bonzini
2012-02-27 13:06           ` Luiz Capitulino
2012-02-27 14:39             ` Paolo Bonzini [this message]
2012-02-27 14:46               ` [Qemu-devel] drive transactions (was Re: [PATCH 2/2 v2] Add the blockdev-reopen and blockdev-migrate commands) Anthony Liguori
2012-02-27 14:54                 ` Paolo Bonzini
2012-02-27 14:59                   ` Anthony Liguori
2012-02-27 15:03                     ` Paolo Bonzini
2012-02-27 15:06                       ` Anthony Liguori
2012-02-27 15:17                     ` Kevin Wolf
2012-02-27 15:24                       ` Anthony Liguori
2012-02-27 16:51                         ` Paolo Bonzini
2012-02-27 16:58                           ` Anthony Liguori
2012-02-27 17:06                             ` Paolo Bonzini
2012-02-27 16:33               ` Federico Simoncelli
2012-02-27 16:41                 ` Paolo Bonzini
2012-02-27 16:42                 ` Anthony Liguori
2012-02-27 16:50                   ` Federico Simoncelli
2012-02-27 16:53                     ` Anthony Liguori
2012-02-27 16:54                       ` Paolo Bonzini
2012-02-27 16:59                         ` Anthony Liguori
2012-02-27 17:37                   ` Luiz Capitulino
2012-02-28 15:47 ` [Qemu-devel] Live Block Migration using Mirroring Stefan Hajnoczi
2012-02-28 17:15   ` Federico Simoncelli
2012-02-28 17:36     ` Paolo Bonzini
2012-02-28 17:46       ` Federico Simoncelli
2012-02-28 18:02         ` Paolo Bonzini
2012-02-28 18:21           ` Federico Simoncelli
2012-02-28 17:26   ` Paolo Bonzini
2012-02-29 12:28   ` [Qemu-devel] [PATCHv3] Add blkmirror block driver Federico Simoncelli
2012-02-29 13:02     ` Federico Simoncelli
2012-02-29 17:01   ` [Qemu-devel] [PATCHv4] " Federico Simoncelli
2012-03-05 16:59 ` [Qemu-devel] Live Block Migration using Mirroring Marcelo Tosatti
2012-03-05 17:20   ` Eric Blake
2012-03-05 17:44     ` Marcelo Tosatti
2012-03-05 18:05       ` Paolo Bonzini

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=4F4B95A5.3000804@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=armbru@redhat.com \
    --cc=fsimonce@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mtosatti@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 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.