From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WW5xe-0003sW-Ur for qemu-devel@nongnu.org; Fri, 04 Apr 2014 11:23:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WW5xY-00012V-PL for qemu-devel@nongnu.org; Fri, 04 Apr 2014 11:23:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2986) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WW5xY-00012P-HH for qemu-devel@nongnu.org; Fri, 04 Apr 2014 11:23:12 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s34FNBmq006744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 4 Apr 2014 11:23:11 -0400 Message-ID: <533ECE5C.4050404@redhat.com> Date: Fri, 04 Apr 2014 17:23:08 +0200 From: Max Reitz MIME-Version: 1.0 References: <1396613033-20222-4-git-send-email-kwolf@redhat.com> <1396623360-6437-1-git-send-email-kwolf@redhat.com> In-Reply-To: <1396623360-6437-1-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 3/3] block: Fix snapshot=on for protocol parsed from filename List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-devel@nongnu.org Cc: stefanha@redhat.com On 04.04.2014 16:56, Kevin Wolf wrote: > Since commit 9fd3171a, BDRV_O_SNAPSHOT uses an option QDict to specify > the originally requested image as the backing file of the newly created > temporary snapshot. This means that the filename is stored in > "file.filename", which is an option that is not parsed for protocol > names. Therefore things like -drive file=nbd:localhost:10809 were > broken because it looked for a local file with the literal name > 'nbd:localhost:10809'. > > This patch changes the way BDRV_O_SNAPSHOT works once again. We now open > the originally requested image as normal, and then do a similar > operation as for live snapshots to put the temporary snapshot on top. > This way, both driver specific options and parsed filenames work. > > As a nice side effect, this results in code movement to factor > bdrv_append_temp_snapshot() out. This is a good preparation for moving > its call to drive_init() and friends eventually. > > Signed-off-by: Kevin Wolf > --- > v2: > - open the backing file for the temporary snapshot read-only from the > beginning so that you can get an r/w block device from a read-only > file using snapshot=on. Gets rid of the bdrv_reopen() whose return > value was ignored in v1, too. > > block.c | 148 ++++++++++++++++++++++++--------------------- > include/block/block.h | 1 + > tests/qemu-iotests/051 | 8 +++ > tests/qemu-iotests/051.out | 28 +++++++++ > 4 files changed, 115 insertions(+), 70 deletions(-) Together with "block: Check bdrv_getlength() return value in bdrv_append_temp_snapshot()": Reviewed-by: Max Reitz