From patchwork Fri Jan 25 18:45:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 215854 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D2EE72C0096 for ; Sat, 26 Jan 2013 07:22:57 +1100 (EST) Received: from localhost ([::1]:34124 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyoJa-0001nP-6q for incoming@patchwork.ozlabs.org; Fri, 25 Jan 2013 13:47:50 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyoIW-00005y-Gs for qemu-devel@nongnu.org; Fri, 25 Jan 2013 13:46:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TyoIV-0007sj-4N for qemu-devel@nongnu.org; Fri, 25 Jan 2013 13:46:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45015) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyoIU-0007sa-Ty for qemu-devel@nongnu.org; Fri, 25 Jan 2013 13:46:43 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0PIkfIt009350 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 25 Jan 2013 13:46:41 -0500 Received: from dhcp-5-188.str.redhat.com (vpn1-6-44.ams2.redhat.com [10.36.6.44]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0PIk1dq018934; Fri, 25 Jan 2013 13:46:38 -0500 From: Kevin Wolf To: anthony@codemonkey.ws Date: Fri, 25 Jan 2013 19:45:59 +0100 Message-Id: <1359139560-15387-24-git-send-email-kwolf@redhat.com> In-Reply-To: <1359139560-15387-1-git-send-email-kwolf@redhat.com> References: <1359139560-15387-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 23/24] block: Create proper size file for disk mirror 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 From: Vishvananda Ishaya The qmp monitor command to mirror a disk was passing -1 for size along with the disk's backing file. This size of the resulting disk is the size of the backing file, which is incorrect if the disk has been resized. Therefore we should always pass in the size of the current disk. Signed-off-by: Vishvananda Ishaya Signed-off-by: Kevin Wolf --- blockdev.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/blockdev.c b/blockdev.c index ac396f3..fdc573f 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1282,11 +1282,11 @@ void qmp_drive_mirror(const char *device, const char *target, return; } + bdrv_get_geometry(bs, &size); + size *= 512; if (sync == MIRROR_SYNC_MODE_FULL && mode != NEW_IMAGE_MODE_EXISTING) { /* create new image w/o backing file */ assert(format && drv); - bdrv_get_geometry(bs, &size); - size *= 512; bdrv_img_create(target, format, NULL, NULL, NULL, size, flags, &local_err); } else { @@ -1299,7 +1299,7 @@ void qmp_drive_mirror(const char *device, const char *target, bdrv_img_create(target, format, source->filename, source->drv->format_name, - NULL, -1, flags, &local_err); + NULL, size, flags, &local_err); break; default: abort();