aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2011-10-07 11:06:41 +0100
committerIan Campbell <ian.campbell@citrix.com>2011-10-07 11:06:41 +0100
commitfe4e6521b6d9ae7513a28d78c2dea40ced663603 (patch)
tree2d9ee40ef71cca621defc33e7aaf98cb57a35f1b /tools
parent5631ee13f8a3c27f73019fc96b80e9a4f5a87a7d (diff)
downloadxen-fe4e6521b6d9ae7513a28d78c2dea40ced663603.tar.gz
xen-fe4e6521b6d9ae7513a28d78c2dea40ced663603.tar.bz2
xen-fe4e6521b6d9ae7513a28d78c2dea40ced663603.zip
xl: use libxl_device_disk_to_json to pretty print disk configuration
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/libxl/check-xl-disk-parse42
-rw-r--r--tools/libxl/xl_cmdimpl.c14
2 files changed, 27 insertions, 29 deletions
diff --git a/tools/libxl/check-xl-disk-parse b/tools/libxl/check-xl-disk-parse
index fec86bee15..dc640729a5 100755
--- a/tools/libxl/check-xl-disk-parse
+++ b/tools/libxl/check-xl-disk-parse
@@ -51,15 +51,18 @@ expected </dev/null
one $e foo
expected <<END
-disk.backend_domid = 0
-disk.pdev_path = /dev/vg/guest-volume
-disk.vdev = hda
-disk.backend = 0
-disk.format = 4
-disk.script = (null)
-disk.removable = 0
-disk.readwrite = 1
-disk.is_cdrom = 0
+disk: {
+ "backend_domid": 0,
+ "pdev_path": "/dev/vg/guest-volume",
+ "vdev": "hda",
+ "backend": "unknown",
+ "format": "raw",
+ "script": null,
+ "removable": 0,
+ "readwrite": 1,
+ "is_cdrom": 0
+}
+
END
one 0 /dev/vg/guest-volume,,hda
one 0 /dev/vg/guest-volume,raw,hda,rw
@@ -68,15 +71,18 @@ one 0 format=raw vdev=hda access=rw target=/dev/vg/guest-volume
one 0 raw:/dev/vg/guest-volume,hda,w
expected <<END
-disk.backend_domid = 0
-disk.pdev_path = /root/image.iso
-disk.vdev = hdc
-disk.backend = 0
-disk.format = 4
-disk.script = (null)
-disk.removable = 1
-disk.readwrite = 0
-disk.is_cdrom = 1
+disk: {
+ "backend_domid": 0,
+ "pdev_path": "/root/image.iso",
+ "vdev": "hdc",
+ "backend": "unknown",
+ "format": "raw",
+ "script": null,
+ "removable": 1,
+ "readwrite": 0,
+ "is_cdrom": 1
+}
+
END
one 0 /root/image.iso,,hdc,cdrom
one 0 /root/image.iso,,hdc,,cdrom
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 9aa989e1b9..a890ef1ddf 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -4112,17 +4112,9 @@ int main_blockattach(int argc, char **argv)
disk.backend_domid = be_domid;
if (dryrun_only) {
- /* fixme: this should be generated from the idl */
- /* fixme: enums (backend, format) should be converted to strings */
- printf("disk.backend_domid = %"PRIx32"\n", disk.backend_domid);
- printf("disk.pdev_path = %s\n", disk.pdev_path);
- printf("disk.vdev = %s\n", disk.vdev);
- printf("disk.backend = %d\n", disk.backend);
- printf("disk.format = %d\n", disk.format);
- printf("disk.script = %s\n", disk.script);
- printf("disk.removable = %d\n", disk.removable);
- printf("disk.readwrite = %d\n", disk.readwrite);
- printf("disk.is_cdrom = %d\n", disk.is_cdrom);
+ char *json = libxl_device_disk_to_json(ctx, &disk);
+ printf("disk: %s\n", json);
+ free(json);
if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); }
return 0;
}