From patchwork Fri Nov 11 20:29:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 125297 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 10099B6FD7 for ; Sat, 12 Nov 2011 07:52:31 +1100 (EST) Received: from localhost ([::1]:38080 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROy5F-0000cv-57 for incoming@patchwork.ozlabs.org; Fri, 11 Nov 2011 15:52:21 -0500 Received: from eggs.gnu.org ([140.186.70.92]:33523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROy4y-0008WG-6w for qemu-devel@nongnu.org; Fri, 11 Nov 2011 15:52:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ROy4s-0002e8-2d for qemu-devel@nongnu.org; Fri, 11 Nov 2011 15:51:59 -0500 Received: from cpe-70-123-132-139.austin.res.rr.com ([70.123.132.139]:39408 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROy4r-0002cg-R7 for qemu-devel@nongnu.org; Fri, 11 Nov 2011 15:51:58 -0500 Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4/Debian-2ubuntu1) with ESMTP id pABKTnwx015391; Fri, 11 Nov 2011 14:29:49 -0600 Received: (from anthony@localhost) by localhost6.localdomain6 (8.14.4/8.14.4/Submit) id pABKTl6d015390; Fri, 11 Nov 2011 14:29:47 -0600 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Fri, 11 Nov 2011 14:29:37 -0600 Message-Id: <1321043378-15344-3-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1321043378-15344-1-git-send-email-aliguori@us.ibm.com> References: <1321043378-15344-1-git-send-email-aliguori@us.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 70.123.132.139 Cc: Kevin Wolf , Lucas Meneghel Rodrigues , Anthony Liguori , Stefan Hajnoczi , Juan Quintela Subject: [Qemu-devel] [PATCH 3/4] qcow2: add a migration blocker X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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) Signed-off-by: Anthony Liguori --- 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 ef057d3..500cbbf 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 @@ -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 } }"