summaryrefslogtreecommitdiffstats
path: root/qemu-img.c
diff options
context:
space:
mode:
authorStefan Hajnoczi2019-12-05 14:46:46 +0100
committerKevin Wolf2019-12-18 11:20:57 +0100
commit0da7d13a4c2ff8ac40aeb1bd24c5564c82624555 (patch)
tree581f9e37bbbcfb0c63cd66334e03760d2155bd77 /qemu-img.c
parentqapi: better document NVMe blockdev @device parameter (diff)
downloadqemu-0da7d13a4c2ff8ac40aeb1bd24c5564c82624555.tar.gz
qemu-0da7d13a4c2ff8ac40aeb1bd24c5564c82624555.tar.xz
qemu-0da7d13a4c2ff8ac40aeb1bd24c5564c82624555.zip
qemu-img: fix info --backing-chain --image-opts
Only apply --image-opts to the topmost image when listing an entire backing chain. It is incorrect to treat backing filenames as image options. Assuming we have the backing chain t.IMGFMT.base <- t.IMGFMT.mid <- t.IMGFMT, qemu-img info fails as follows: $ qemu-img info --backing-chain --image-opts \ driver=qcow2,file.driver=file,file.filename=t.IMGFMT qemu-img: Could not open 'TEST_DIR/t.IMGFMT.mid': Cannot find device=TEST_DIR/t.IMGFMT.mid nor node_name=TEST_DIR/t.IMGFMT.mid Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 95a24b9762..6233b8ca56 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2680,7 +2680,10 @@ static ImageInfoList *collect_image_info_list(bool image_opts,
blk_unref(blk);
+ /* Clear parameters that only apply to the topmost image */
filename = fmt = NULL;
+ image_opts = false;
+
if (chain) {
if (info->has_full_backing_filename) {
filename = info->full_backing_filename;