From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsqBF-00065Q-Mf for qemu-devel@nongnu.org; Mon, 24 Nov 2014 04:43:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XsqB9-0007wg-56 for qemu-devel@nongnu.org; Mon, 24 Nov 2014 04:43:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsqB8-0007wQ-OW for qemu-devel@nongnu.org; Mon, 24 Nov 2014 04:43:31 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAO9hUPg014469 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 24 Nov 2014 04:43:30 -0500 From: Max Reitz Date: Mon, 24 Nov 2014 10:43:19 +0100 Message-Id: <1416822200-31088-5-git-send-email-mreitz@redhat.com> In-Reply-To: <1416822200-31088-1-git-send-email-mreitz@redhat.com> References: <1416822200-31088-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v3 4/5] block/vmdk: Relative backing file for creation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , Max Reitz When a vmdk image is created with a backing file, it is opened to check whether it is indeed a vmdk file by letting qemu probe it. When doing so, the backing filename is relative to the image's base directory so it should be interpreted accordingly. Signed-off-by: Max Reitz --- block/vmdk.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/block/vmdk.c b/block/vmdk.c index 2cbfd3e..aea8f07 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1868,8 +1868,19 @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp) } if (backing_file) { BlockDriverState *bs = NULL; - ret = bdrv_open(&bs, backing_file, NULL, NULL, BDRV_O_NO_BACKING, NULL, + char *full_backing = g_new0(char, PATH_MAX); + bdrv_get_full_backing_filename_from_filename(filename, backing_file, + full_backing, PATH_MAX, + &local_err); + if (local_err) { + g_free(full_backing); + error_propagate(errp, local_err); + ret = -ENOENT; + goto exit; + } + ret = bdrv_open(&bs, full_backing, NULL, NULL, BDRV_O_NO_BACKING, NULL, errp); + g_free(full_backing); if (ret != 0) { goto exit; } -- 1.9.3