[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 06/10] qemu-img: Prepare for locked images
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 06/10] qemu-img: Prepare for locked images |
Date: |
Tue, 22 Dec 2015 14:41:16 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 12/22/2015 09:46 AM, Kevin Wolf wrote:
> This patch extends qemu-img for working with locked images. It prints a
> helpful error message when trying to access a locked image read-write,
> and adds a 'qemu-img force-unlock' command as well as a 'qemu-img check
> -r all --force' option in order to override a lock left behind after a
> qemu crash.
>
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> include/block/block.h | 1 +
> include/qapi/error.h | 1 +
> qapi/common.json | 3 +-
> qemu-img-cmds.hx | 10 ++++--
> qemu-img.c | 96
> +++++++++++++++++++++++++++++++++++++++++++--------
> qemu-img.texi | 20 ++++++++++-
> 6 files changed, 113 insertions(+), 18 deletions(-)
>
> diff --git a/include/block/block.h b/include/block/block.h
> index 0d00ac1..1ae655c 100644
> --- a/include/block/block.h
> +++ b/include/block/block.h
> @@ -101,6 +101,7 @@ typedef struct HDGeometry {
> #define BDRV_OPT_CACHE_DIRECT "cache.direct"
> #define BDRV_OPT_CACHE_NO_FLUSH "cache.no-flush"
>
> +#define BDRV_OPT_OVERRIDE_LOCK "override-lock"
New dict key here...
>
> blk = blk_new_open(id, filename, NULL, options, flags, &local_err);
> + if (!blk && error_get_class(local_err) == ERROR_CLASS_IMAGE_FILE_LOCKED)
> {
> + if (force) {
> + qdict_put(options, BDRV_OPT_OVERRIDE_LOCK,
> qstring_from_str("on"));
...but not supported by any of the block drivers until 10/10 adds it for
qcow2. I guess what happens is that...
> + blk = blk_new_open(id, filename, NULL, options, flags, NULL);
...the second blk_new_open() fails if the option is unrecognized, but we
ignore the second failure; and therefore the option makes a difference
only if the block driver understands the option.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 04/10] block: Fix error path in bdrv_invalidate_cache(), (continued)
- [Qemu-devel] [PATCH 04/10] block: Fix error path in bdrv_invalidate_cache(), Kevin Wolf, 2015/12/22
- [Qemu-devel] [PATCH 05/10] block: Inactivate BDS when migration completes, Kevin Wolf, 2015/12/22
- [Qemu-devel] [PATCH 07/10] qcow2: Implement .bdrv_inactivate, Kevin Wolf, 2015/12/22
- [Qemu-devel] [PATCH 06/10] qemu-img: Prepare for locked images, Kevin Wolf, 2015/12/22
- [Qemu-devel] [PATCH 08/10] qcow2: Fix BDRV_O_INCOMING handling in qcow2_invalidate_cache(), Kevin Wolf, 2015/12/22
- [Qemu-devel] [PATCH 09/10] qcow2: Make image inaccessible after failed qcow2_invalidate_cache(), Kevin Wolf, 2015/12/22
- [Qemu-devel] [PATCH 10/10] qcow2: Add image locking, Kevin Wolf, 2015/12/22
- Re: [Qemu-devel] [PATCH 00/10] qcow2: Implement image locking, Fam Zheng, 2015/12/22