From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtjZo-0005pn-Ja for qemu-devel@nongnu.org; Thu, 19 Dec 2013 14:48:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtjZO-0004uG-Jf for qemu-devel@nongnu.org; Thu, 19 Dec 2013 14:48:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44621) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtjZO-0004tv-2M for qemu-devel@nongnu.org; Thu, 19 Dec 2013 14:47:42 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBJJlfkm023542 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 19 Dec 2013 14:47:41 -0500 From: Max Reitz Date: Thu, 19 Dec 2013 20:47:14 +0100 Message-Id: <1387482443-10633-14-git-send-email-mreitz@redhat.com> In-Reply-To: <1387482443-10633-1-git-send-email-mreitz@redhat.com> References: <1387482443-10633-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v6 13/22] block: Allow recursive "file"s List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Fam Zheng , Stefan Hajnoczi , Max Reitz It should be possible to use a format as a driver for a file which in turn requires another file, i.e., nesting file formats. Allowing nested file formats results in e.g. qcow2 BlockDriverStates never being directly passed to bdrv_open_common() from bdrv_file_open(), but instead being handed through bdrv_open(). This changes the error message when trying to give a filename to qcow2, i.e. trying to use it as a driver for the protocol level. Therefore, change the reference output of I/O test 051 accordingly. Signed-off-by: Max Reitz --- block.c | 9 +++++++-- tests/qemu-iotests/051.out | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index 9e4e85f..6af5f6e 100644 --- a/block.c +++ b/block.c @@ -948,14 +948,19 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename, goto fail; } - ret = bdrv_open_common(bs, NULL, options, flags, drv, &local_err); + if (!drv->bdrv_file_open) { + ret = bdrv_open(bs, filename, options, flags, drv, &local_err); + options = NULL; + } else { + ret = bdrv_open_common(bs, NULL, options, flags, drv, &local_err); + } if (ret < 0) { error_propagate(errp, local_err); goto fail; } /* Check if any unknown options were used */ - if (qdict_size(options) != 0) { + if (options && (qdict_size(options) != 0)) { const QDictEntry *entry = qdict_first(options); error_setg(errp, "Block protocol '%s' doesn't support the option '%s'", drv->format_name, entry->key); diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out index 49e95a2..121ca66 100644 --- a/tests/qemu-iotests/051.out +++ b/tests/qemu-iotests/051.out @@ -223,7 +223,7 @@ QEMU X.Y.Z monitor - type 'help' for more information (qemu) qququiquit Testing: -drive file=TEST_DIR/t.qcow2,file.driver=qcow2 -QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.driver=qcow2: could not open disk image TEST_DIR/t.qcow2: Can't use 'qcow2' as a block driver for the protocol level +QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.driver=qcow2: could not open disk image TEST_DIR/t.qcow2: Block format 'qcow2' used by device '' doesn't support the option 'filename' === Parsing protocol from file name === -- 1.8.5.1