From: John Snow <jsnow@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, John Snow <jsnow@redhat.com>,
qemu-devel@nongnu.org, mreitz@redhat.com
Subject: [Qemu-devel] [PATCH v2 4/4] block/qapi: allow best-effort query
Date: Fri, 11 Dec 2015 20:25:28 -0500 [thread overview]
Message-ID: <1449883528-26477-5-git-send-email-jsnow@redhat.com> (raw)
In-Reply-To: <1449883528-26477-1-git-send-email-jsnow@redhat.com>
For more complex BDS trees that can be created under normal circumstances,
we lose the ability to issue query commands because of our inability to
re-construct the absolute filename.
Instead, omit this field when it is a problem and present as much information
as we can.
This will change the expected output in iotest 110, where we will now see a
json filename and the lack of an absolute filename instead of an error.
Signed-off-by: John Snow <jsnow@redhat.com>
---
block/qapi.c | 7 ++++---
tests/qemu-iotests/110.out | 5 ++++-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/block/qapi.c b/block/qapi.c
index 0e6b333..f581c48 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -245,10 +245,11 @@ void bdrv_query_image_info(BlockDriverState *bs,
info->has_backing_filename = true;
bdrv_get_full_backing_filename(bs, backing_filename2, PATH_MAX, &err);
if (err) {
- error_propagate(errp, err);
- qapi_free_ImageInfo(info);
+ /* Can't reconstruct the full backing filename, so we must omit
+ * this field and apply a Best Effort to this query. */
g_free(backing_filename2);
- return;
+ backing_filename2 = NULL;
+ error_free(err);
}
/* Always report the full_backing_filename if present, even if it's the
diff --git a/tests/qemu-iotests/110.out b/tests/qemu-iotests/110.out
index 0270980..425485f 100644
--- a/tests/qemu-iotests/110.out
+++ b/tests/qemu-iotests/110.out
@@ -11,7 +11,10 @@ backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base)
=== Non-reconstructable filename ===
-qemu-img: Cannot use relative backing file names for 'json:{"driver": "IMGFMT", "file": {"set-state.0.event": "read_aio", "image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug", "set-state.0.new_state": 42}}'
+image: json:{"driver": "IMGFMT", "file": {"set-state.0.event": "read_aio", "image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug", "set-state.0.new_state": 42}}
+file format: IMGFMT
+virtual size: 64M (67108864 bytes)
+backing file: t.IMGFMT.base
=== Backing name is always relative to the backed image ===
--
2.4.3
next prev parent reply other threads:[~2015-12-12 1:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-12 1:25 [Qemu-devel] [PATCH v2 0/4] block: allow partial info-block query John Snow
2015-12-12 1:25 ` [Qemu-devel] [PATCH v2 1/4] block/qapi: do not redundantly print "actual path" John Snow
2015-12-14 15:17 ` Max Reitz
2015-12-12 1:25 ` [Qemu-devel] [PATCH v2 2/4] block/qapi: always report full_backing_filename John Snow
2015-12-14 16:36 ` Max Reitz
2015-12-14 16:38 ` John Snow
2015-12-14 16:39 ` Max Reitz
2015-12-12 1:25 ` [Qemu-devel] [PATCH v2 3/4] qemu-img: abort when full_backing_filename not present John Snow
2015-12-14 16:39 ` Max Reitz
2015-12-12 1:25 ` John Snow [this message]
2015-12-14 16:50 ` [Qemu-devel] [PATCH v2 4/4] block/qapi: allow best-effort query Max Reitz
2015-12-14 17:13 ` [Qemu-devel] [PATCH v2 0/4] block: allow partial info-block query Max Reitz
2015-12-14 17:23 ` John Snow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1449883528-26477-5-git-send-email-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).