[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xl: use libxl_device_disk_to_json to pretty print disk configuration



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1317982001 -3600
# Node ID dafd08abcc8d0fcf10f05f9f1715229a0898e03f
# Parent  3581fff36a3d0efa60347e5104f8b8565258719f
xl: use libxl_device_disk_to_json to pretty print disk configuration

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 3581fff36a3d -r dafd08abcc8d tools/libxl/check-xl-disk-parse
--- a/tools/libxl/check-xl-disk-parse   Fri Oct 07 11:05:47 2011 +0100
+++ b/tools/libxl/check-xl-disk-parse   Fri Oct 07 11:06:41 2011 +0100
@@ -51,15 +51,18 @@
 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 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 -r 3581fff36a3d -r dafd08abcc8d tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Fri Oct 07 11:05:47 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Fri Oct 07 11:06:41 2011 +0100
@@ -4112,17 +4112,9 @@
     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;
     }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.