[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v12 04/16] qemu-img: Set "share-rw" flag in read-onl
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH v12 04/16] qemu-img: Set "share-rw" flag in read-only commands |
Date: |
Mon, 23 Jan 2017 20:30:44 +0800 |
Checking the status of an image when it is being used by guest is
usually useful, and there is no risk of corrupting data, so don't let
the upcoming image locking feature limit this use case.
Signed-off-by: Fam Zheng <address@hidden>
---
qemu-img.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index 5df66fe..6a091e0 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -705,6 +705,10 @@ static int img_check(int argc, char **argv)
return 1;
}
+ if (!(flags & BDRV_O_RDWR)) {
+ flags |= BDRV_O_SHARE_RW;
+ }
+
blk = img_open(image_opts, filename, fmt, flags, writethrough, quiet);
if (!blk) {
return 1;
@@ -1238,6 +1242,7 @@ static int img_compare(int argc, char **argv)
goto out3;
}
+ flags |= BDRV_O_SHARE_RW;
blk1 = img_open(image_opts, filename1, fmt1, flags, writethrough, quiet);
if (!blk1) {
ret = 2;
@@ -2286,7 +2291,8 @@ static ImageInfoList *collect_image_info_list(bool
image_opts,
g_hash_table_insert(filenames, (gpointer)filename, NULL);
blk = img_open(image_opts, filename, fmt,
- BDRV_O_NO_BACKING | BDRV_O_NO_IO, false, false);
+ BDRV_O_NO_BACKING | BDRV_O_NO_IO | BDRV_O_SHARE_RW,
+ false, false);
if (!blk) {
goto err;
}
@@ -2612,7 +2618,7 @@ static int img_map(int argc, char **argv)
return 1;
}
- blk = img_open(image_opts, filename, fmt, 0, false, false);
+ blk = img_open(image_opts, filename, fmt, BDRV_O_SHARE_RW, false, false);
if (!blk) {
return 1;
}
--
2.9.3
- [Qemu-devel] [PATCH v12 00/16] block: Image locking series, Fam Zheng, 2017/01/23
- [Qemu-devel] [PATCH v12 02/16] block: Define BDRV_O_SHARE_RW, Fam Zheng, 2017/01/23
- [Qemu-devel] [PATCH v12 01/16] osdep: Add qemu_lock_fd and qemu_unlock_fd, Fam Zheng, 2017/01/23
- [Qemu-devel] [PATCH v12 04/16] qemu-img: Set "share-rw" flag in read-only commands,
Fam Zheng <=
- [Qemu-devel] [PATCH v12 03/16] qemu-io: Set "share-rw" flag together with read-only, Fam Zheng, 2017/01/23
- [Qemu-devel] [PATCH v12 05/16] block: Set "share-rw" flag in drive-backup when sync=none, Fam Zheng, 2017/01/23
- [Qemu-devel] [PATCH v12 06/16] iotests: 055: Don't attach the drive to vm for drive-backup, Fam Zheng, 2017/01/23
- [Qemu-devel] [PATCH v12 07/16] iotests: 030: Read-only open image for getting map, Fam Zheng, 2017/01/23
- [Qemu-devel] [PATCH v12 08/16] iotests: 087: Don't attach test image twice, Fam Zheng, 2017/01/23
- [Qemu-devel] [PATCH v12 09/16] iotests: 085: Avoid image locking conflict, Fam Zheng, 2017/01/23
- [Qemu-devel] [PATCH v12 10/16] iotests: 091: Quit QEMU before checking image, Fam Zheng, 2017/01/23
- [Qemu-devel] [PATCH v12 12/16] tests: Use null-co:// instead of /dev/null as the dummy image, Fam Zheng, 2017/01/23
- [Qemu-devel] [PATCH v12 11/16] iotests: 172: Use separate images for multiple devices, Fam Zheng, 2017/01/23
- [Qemu-devel] [PATCH v12 13/16] tests: Disable image lock in test-replication, Fam Zheng, 2017/01/23