All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	Juan Quintela <quintela@redhat.com>,
	qemu-devel@nongnu.org, Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/7] qcow2: add a migration blocker
Date: Mon, 14 Nov 2011 15:58:00 -0200	[thread overview]
Message-ID: <4EC156A8.7030808@redhat.com> (raw)
In-Reply-To: <1321113459-3331-3-git-send-email-aliguori@us.ibm.com>

On 11/12/2011 01:57 PM, Anthony Liguori wrote:
> Now when you try to migrate with qcow2, you get:
>
> (qemu) migrate tcp:localhost:1025
> Block format 'qcow2' used by device 'ide0-hd0' does not support feature 'live migration'
> (qemu)

LGTM. From a testing perspective, it's clear and understandable, a lot 
better than throwing a generic error.

> Signed-off-by: Anthony Liguori<aliguori@us.ibm.com>
> ---
>   block/qcow2.c |    9 +++++++++
>   block/qcow2.h |    2 ++
>   qemu-tool.c   |    9 +++++++++
>   qerror.c      |    4 ++++
>   qerror.h      |    3 +++
>   5 files changed, 27 insertions(+), 0 deletions(-)
>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 5c784ee..e4126b7 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -29,6 +29,7 @@
>   #include "block/qcow2.h"
>   #include "qemu-error.h"
>   #include "qerror.h"
> +#include "migration.h"
>
>   /*
>     Differences with QCOW:
> @@ -277,6 +278,11 @@ static int qcow2_open(BlockDriverState *bs, int flags)
>           goto fail;
>       }
>
> +    error_set(&s->migration_blocker,
> +              QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
> +              "qcow2", bs->device_name, "live migration");
> +    migrate_add_blocker(s->migration_blocker);
> +
>       /* Initialise locks */
>       qemu_co_mutex_init(&s->lock);
>
> @@ -621,6 +627,9 @@ static void qcow2_close(BlockDriverState *bs)
>       BDRVQcowState *s = bs->opaque;
>       g_free(s->l1_table);
>
> +    migrate_del_blocker(s->migration_blocker);
> +    error_free(s->migration_blocker);
> +
>       qcow2_cache_flush(bs, s->l2_table_cache);
>       qcow2_cache_flush(bs, s->refcount_block_cache);
>
> diff --git a/block/qcow2.h b/block/qcow2.h
> index 531af39..0734b23 100644
> --- a/block/qcow2.h
> +++ b/block/qcow2.h
> @@ -125,6 +125,8 @@ typedef struct BDRVQcowState {
>       int snapshots_size;
>       int nb_snapshots;
>       QCowSnapshot *snapshots;
> +
> +    Error *migration_blocker;
>   } BDRVQcowState;
>
>   /* XXX: use std qcow open function ? */
> diff --git a/qemu-tool.c b/qemu-tool.c
> index e9f7fe1..5df7279 100644
> --- a/qemu-tool.c
> +++ b/qemu-tool.c
> @@ -15,6 +15,7 @@
>   #include "monitor.h"
>   #include "qemu-timer.h"
>   #include "qemu-log.h"
> +#include "migration.h"
>
>   #include<sys/time.h>
>
> @@ -92,3 +93,11 @@ int64_t qemu_get_clock_ns(QEMUClock *clock)
>   {
>       return 0;
>   }
> +
> +void migrate_add_blocker(Error *reason)
> +{
> +}
> +
> +void migrate_del_blocker(Error *reason)
> +{
> +}
> diff --git a/qerror.c b/qerror.c
> index 8e30e2d..fdf62b9 100644
> --- a/qerror.c
> +++ b/qerror.c
> @@ -49,6 +49,10 @@ static const QErrorStringTable qerror_table[] = {
>           .desc      = "Device '%(device)' can't go on a %(bad_bus_type) bus",
>       },
>       {
> +        .error_fmt = QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
> +        .desc      = "Block format '%(format)' used by device '%(name)' does not support feature '%(feature)'",
> +    },
> +    {
>           .error_fmt = QERR_BUS_NOT_FOUND,
>           .desc      = "Bus '%(bus)' not found",
>       },
> diff --git a/qerror.h b/qerror.h
> index 7e2eebf..2d3d43b 100644
> --- a/qerror.h
> +++ b/qerror.h
> @@ -54,6 +54,9 @@ QError *qobject_to_qerror(const QObject *obj);
>   #define QERR_BAD_BUS_FOR_DEVICE \
>       "{ 'class': 'BadBusForDevice', 'data': { 'device': %s, 'bad_bus_type': %s } }"
>
> +#define QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED \
> +    "{ 'class': 'BlockFormatFeatureNotSupported', 'data': { 'format': %s, 'name': %s, 'feature': %s } }"
> +
>   #define QERR_BUS_NOT_FOUND \
>       "{ 'class': 'BusNotFound', 'data': { 'bus': %s } }"
>

  reply	other threads:[~2011-11-14 17:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-12 15:57 [Qemu-devel] [PATCH 1/7] migrate: add migration blockers Anthony Liguori
2011-11-12 15:57 ` [Qemu-devel] [PATCH 2/7] ivshmem: use migration blockers to prevent live migration in peer mode Anthony Liguori
2011-11-12 15:57 ` [Qemu-devel] [PATCH 3/7] qcow2: add a migration blocker Anthony Liguori
2011-11-14 17:58   ` Lucas Meneghel Rodrigues [this message]
2011-11-12 15:57 ` [Qemu-devel] [PATCH 4/7] qed: add " Anthony Liguori
2011-11-12 15:57 ` [Qemu-devel] [PATCH 5/7] block: allow migration to work with image files (v2) Anthony Liguori
2011-11-12 15:57 ` [Qemu-devel] [PATCH 6/7] qcow2: implement bdrv_invalidate_cache Anthony Liguori
2011-11-12 15:57 ` [Qemu-devel] [PATCH 7/7] qcow2: relax migration blocker Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2011-11-12 15:56 [Qemu-devel] [PATCH 1/7] migrate: add migration blockers Anthony Liguori
2011-11-12 15:56 ` [Qemu-devel] [PATCH 3/7] qcow2: add a migration blocker Anthony Liguori

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=4EC156A8.7030808@redhat.com \
    --to=lmr@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@linux.vnet.ibm.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.