[qemu-xen master] block: Open backing image in force share mode for size probe

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[qemu-xen master] block: Open backing image in force share mode for size probe

patchbot
commit 7f53a8107386d2943ff83c3224775a3eea82b767
Author:     Fam Zheng <[hidden email]>
AuthorDate: Fri Dec 15 16:04:45 2017 +0800
Commit:     Michael Roth <[hidden email]>
CommitDate: Tue Jan 9 10:49:44 2018 -0600

    block: Open backing image in force share mode for size probe
   
    Management tools create overlays of running guests with qemu-img:
   
      $ qemu-img create -b /image/in/use.qcow2 -f qcow2 /overlay/image.qcow2
   
    but this doesn't work anymore due to image locking:
   
        qemu-img: /overlay/image.qcow2: Failed to get shared "write" lock
        Is another process using the image?
        Could not open backing image to determine size.
    Use the force share option to allow this use case again.
   
    Cc: [hidden email]
    Signed-off-by: Fam Zheng <[hidden email]>
    Reviewed-by: Eric Blake <[hidden email]>
    Signed-off-by: Kevin Wolf <[hidden email]>
    (cherry picked from commit cc954f01e3c004aad081aa36736a17e842b80211)
    Signed-off-by: Michael Roth <[hidden email]>
---
 block.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block.c b/block.c
index 9a1a0d1..f236431 100644
--- a/block.c
+++ b/block.c
@@ -4593,10 +4593,11 @@ void bdrv_img_create(const char *filename, const char *fmt,
         back_flags = flags;
         back_flags &= ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING);
 
+        backing_options = qdict_new();
         if (backing_fmt) {
-            backing_options = qdict_new();
             qdict_put_str(backing_options, "driver", backing_fmt);
         }
+        qdict_put_bool(backing_options, BDRV_OPT_FORCE_SHARE, true);
 
         bs = bdrv_open(full_backing, NULL, backing_options, back_flags,
                        &local_err);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog