Patchwork [3/4,v3] block: add dirty flag status to qemu-img

login
register
mail settings
Submitter Robert Wang
Date March 15, 2012, 12:47 p.m.
Message ID <1331815641-4789-3-git-send-email-wdongxu@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/146940/
State New
Headers show

Comments

Robert Wang - March 15, 2012, 12:47 p.m.
From: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>

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>
---
 block.h    |    1 +
 qemu-img.c |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)

Patch

diff --git a/block.h b/block.h
index 32e1e58..12219d0 100644
--- 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 {
diff --git a/qemu-img.c b/qemu-img.c
index 4de48ba..6a61ca8 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -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') {