[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/11] Don't require encryption password for 'qemu-i
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 10/11] Don't require encryption password for 'qemu-img info' command |
Date: |
Fri, 14 Sep 2012 14:39:11 +0200 |
From: "Daniel P. Berrange" <address@hidden>
The encryption password is only required if I/O is going to be
performed on a disk image. The 'qemu-img info' command merely
reports metadata, so it should not ask for a decryption password
Signed-off-by: Daniel P. Berrange <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
qemu-img.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index 30e33c7..a374d67 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -226,7 +226,8 @@ static int print_block_option_help(const char *filename,
const char *fmt)
static BlockDriverState *bdrv_new_open(const char *filename,
const char *fmt,
- int flags)
+ int flags,
+ bool require_io)
{
BlockDriverState *bs;
BlockDriver *drv;
@@ -251,7 +252,7 @@ static BlockDriverState *bdrv_new_open(const char *filename,
goto fail;
}
- if (bdrv_is_encrypted(bs)) {
+ if (bdrv_is_encrypted(bs) && require_io) {
printf("Disk image '%s' is encrypted.\n", filename);
if (read_password(password, sizeof(password)) < 0) {
error_report("No password given");
@@ -418,7 +419,7 @@ static int img_check(int argc, char **argv)
}
filename = argv[optind++];
- bs = bdrv_new_open(filename, fmt, flags);
+ bs = bdrv_new_open(filename, fmt, flags, true);
if (!bs) {
return 1;
}
@@ -525,7 +526,7 @@ static int img_commit(int argc, char **argv)
return -1;
}
- bs = bdrv_new_open(filename, fmt, flags);
+ bs = bdrv_new_open(filename, fmt, flags, true);
if (!bs) {
return 1;
}
@@ -767,7 +768,7 @@ static int img_convert(int argc, char **argv)
total_sectors = 0;
for (bs_i = 0; bs_i < bs_n; bs_i++) {
- bs[bs_i] = bdrv_new_open(argv[optind + bs_i], fmt, BDRV_O_FLAGS);
+ bs[bs_i] = bdrv_new_open(argv[optind + bs_i], fmt, BDRV_O_FLAGS, true);
if (!bs[bs_i]) {
error_report("Could not open '%s'", argv[optind + bs_i]);
ret = -1;
@@ -886,7 +887,7 @@ static int img_convert(int argc, char **argv)
return -1;
}
- out_bs = bdrv_new_open(out_filename, out_fmt, flags);
+ out_bs = bdrv_new_open(out_filename, out_fmt, flags, true);
if (!out_bs) {
ret = -1;
goto out;
@@ -1305,7 +1306,7 @@ static int img_info(int argc, char **argv)
return 1;
}
- bs = bdrv_new_open(filename, fmt, BDRV_O_FLAGS | BDRV_O_NO_BACKING);
+ bs = bdrv_new_open(filename, fmt, BDRV_O_FLAGS | BDRV_O_NO_BACKING, false);
if (!bs) {
return 1;
}
@@ -1396,7 +1397,7 @@ static int img_snapshot(int argc, char **argv)
filename = argv[optind++];
/* Open the image */
- bs = bdrv_new_open(filename, NULL, bdrv_oflags);
+ bs = bdrv_new_open(filename, NULL, bdrv_oflags, true);
if (!bs) {
return 1;
}
@@ -1514,7 +1515,7 @@ static int img_rebase(int argc, char **argv)
* Ignore the old backing file for unsafe rebase in case we want to correct
* the reference to a renamed or moved backing file.
*/
- bs = bdrv_new_open(filename, fmt, flags);
+ bs = bdrv_new_open(filename, fmt, flags, true);
if (!bs) {
return 1;
}
@@ -1787,7 +1788,7 @@ static int img_resize(int argc, char **argv)
n = qemu_opt_get_size(param, BLOCK_OPT_SIZE, 0);
qemu_opts_del(param);
- bs = bdrv_new_open(filename, fmt, BDRV_O_FLAGS | BDRV_O_RDWR);
+ bs = bdrv_new_open(filename, fmt, BDRV_O_FLAGS | BDRV_O_RDWR, true);
if (!bs) {
ret = -1;
goto out;
--
1.7.6.5
- [Qemu-devel] [PULL 00/11] Block patches, Kevin Wolf, 2012/09/14
- [Qemu-devel] [PATCH 04/11] block/curl: Fix wrong free statement, Kevin Wolf, 2012/09/14
- [Qemu-devel] [PATCH 05/11] vdi: Fix warning from clang, Kevin Wolf, 2012/09/14
- [Qemu-devel] [PATCH 01/11] sheepdog: fix savevm and loadvm, Kevin Wolf, 2012/09/14
- [Qemu-devel] [PATCH 08/11] qapi: Add SnapshotInfo and ImageInfo., Kevin Wolf, 2012/09/14
- [Qemu-devel] [PATCH 02/11] ATAPI: STARTSTOPUNIT only eject/load media if powercondition is 0, Kevin Wolf, 2012/09/14
- [Qemu-devel] [PATCH 07/11] ahci: properly reset PxCMD on HBA reset, Kevin Wolf, 2012/09/14
- [Qemu-devel] [PATCH 03/11] ide: Fix error messages from static code analysis (no real error), Kevin Wolf, 2012/09/14
- [Qemu-devel] [PATCH 06/11] block: fix block tray status, Kevin Wolf, 2012/09/14
- [Qemu-devel] [PATCH 10/11] Don't require encryption password for 'qemu-img info' command,
Kevin Wolf <=
- [Qemu-devel] [PATCH 09/11] qemu-img: Add json output option to the info command., Kevin Wolf, 2012/09/14
- [Qemu-devel] [PATCH 11/11] block: Don't forget to delete temporary file, Kevin Wolf, 2012/09/14
- Re: [Qemu-devel] [PULL 00/11] Block patches, Anthony Liguori, 2012/09/17
- Re: [Qemu-devel] [PULL 00/11] Block patches, Michael Tokarev, 2012/09/18