aboutsummaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-05-08 16:51:50 +0200
committerKevin Wolf <kwolf@redhat.com>2012-05-10 10:32:12 +0200
commitdc5a137125d6ac641c566f10e68bf6e1fe31bcb5 (patch)
tree27ae82c1b297705351bbfdd8852b416e4804e4e3 /qemu-img.c
parent6405875cdd10e531ad3dedaad86ae1ccc4b14f20 (diff)
qemu-img: make "info" backing file output correct and easier to use
qemu-img info should use the same logic as qemu when printing the backing file path, or debugging becomes quite tricky. We can also simplify the output in case the backing file has an absolute path or a protocol. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 0ae543cade..5434ddc5ee 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1138,11 +1138,13 @@ static int img_info(int argc, char **argv)
}
bdrv_get_backing_filename(bs, backing_filename, sizeof(backing_filename));
if (backing_filename[0] != '\0') {
- path_combine(backing_filename2, sizeof(backing_filename2),
- filename, backing_filename);
- printf("backing file: %s (actual path: %s)\n",
- backing_filename,
- backing_filename2);
+ bdrv_get_full_backing_filename(bs, backing_filename2,
+ sizeof(backing_filename2));
+ printf("backing file: %s", backing_filename);
+ if (strcmp(backing_filename, backing_filename2) != 0) {
+ printf(" (actual path: %s)", backing_filename2);
+ }
+ putchar('\n');
}
dump_snapshots(bs);
bdrv_delete(bs);