Skip to contentSkip to conversation

[4977] qemu-img: set encrypted disk image password (Laurent Vivier)

Qemu-devel Anthony Liguori 1 participant 1 message Aug 1, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 4977

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4977
Author:   aliguori
Date:     2008-08-01 15:00:04 +0000 (Fri, 01 Aug 2008)

Log Message:
-----------
qemu-img: set encrypted disk image password (Laurent Vivier)

This patch modify qemu-img to ask and set a password when an encrypted disk image is created.

Modified Paths:
--------------
trunk/qemu-img.c

Modified: trunk/qemu-img.c
===================================================================

qemu-img.c +4 -1
@@ -208,6 +208,7 @@
     uint64_t size;
     const char *p;
     BlockDriver *drv;
+    BlockDriverState *bs;
 
     flags = 0;
     for(;;) {
@@ -237,7 +238,6 @@
     filename = argv[optind++];
     size = 0;
     if (base_filename) {
-        BlockDriverState *bs;
         bs = bdrv_new_open(base_filename, NULL);
         bdrv_get_geometry(bs, &size);
         size *= 512;
@@ -279,6 +279,9 @@
             error("Error while formatting");
         }
     }
+    /* to set password */
+    bs = bdrv_new_open(filename, NULL);
+    bdrv_delete(bs);
     return 0;
 }