qemu-img: add dirty flag status
authorDong Xu Wang <wdongxu@linux.vnet.ibm.com>
Thu, 15 Mar 2012 12:13:33 +0000 (20:13 +0800)
committerKevin Wolf <kwolf@redhat.com>
Thu, 5 Apr 2012 12:54:41 +0000 (14:54 +0200)
Some block drivers can verify their image files are clean or not. So we can show
it while using "qemu-img info".

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.h
qemu-img.c

diff --git a/block.h b/block.h
index ea12f5df301edb4bd7a4b166a02e6a3e69c566b9..4e99e1816eb69f654c03e423270a6fa5fc121a1e 100644 (file)
--- a/block.h
+++ b/block.h
@@ -15,6 +15,7 @@ typedef struct BlockDriverInfo {
     int cluster_size;
     /* offset at which the VM state can be saved (0 if not possible) */
     int64_t vm_state_offset;
+    bool is_dirty;
 } BlockDriverInfo;
 
 typedef struct BlockFragInfo {
index 4de48bac580aef67b44dac4fe04fa14d570ded3a..6a61ca8d06e46c2173da43372a6013f399063b0e 100644 (file)
@@ -1132,6 +1132,9 @@ static int img_info(int argc, char **argv)
         if (bdi.cluster_size != 0) {
             printf("cluster_size: %d\n", bdi.cluster_size);
         }
+        if (bdi.is_dirty) {
+            printf("cleanly shut down: no\n");
+        }
     }
     bdrv_get_backing_filename(bs, backing_filename, sizeof(backing_filename));
     if (backing_filename[0] != '\0') {