Signed-off-by: Kevin Wolf <kw...@redhat.com> --- qapi/block-core.json | 1 + block/qcow2.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/qapi/block-core.json b/qapi/block-core.json index 060df28797..0eb0637b64 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -74,6 +74,7 @@ { 'struct': 'ImageInfoSpecificQCow2', 'data': { 'compat': 'str', + '*data-file': 'str', '*lazy-refcounts': 'bool', '*corrupt': 'bool', 'refcount-bits': 'int', diff --git a/block/qcow2.c b/block/qcow2.c index 4959bf16a4..e3427f9fcd 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1459,7 +1459,9 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, if (s->incompatible_features & QCOW2_INCOMPAT_DATA_FILE) { s->data_file = bdrv_open_child(NULL, options, "data-file", bs, &child_file, false, &local_err); - if (!s->data_file) { + if (s->data_file) { + s->image_data_file = g_strdup(s->data_file->bs->filename); + } else { if (s->image_data_file) { error_free(local_err); local_err = NULL; @@ -4533,6 +4535,8 @@ static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs) QCOW2_INCOMPAT_CORRUPT, .has_corrupt = true, .refcount_bits = s->refcount_bits, + .has_data_file = !!s->image_data_file, + .data_file = g_strdup(s->image_data_file), }; } else { /* if this assertion fails, this probably means a new version was -- 2.20.1