Lars Seipel
2017-Nov-23  05:15 UTC
[Libguestfs] [PATCH] launch: direct: Omit locking option for non-file disks (RHBZ#1516094)
QEMU does not accept options unrecognized by the block driver
in use. Disable locking only for read-only disks that are
file-backed, as that's the only block driver it is supported
with.
Signed-off-by: Lars Seipel <ls@slrz.net>
---
 lib/launch-direct.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/launch-direct.c b/lib/launch-direct.c
index 87ac121c7558..678c8c68d59d 100644
--- a/lib/launch-direct.c
+++ b/lib/launch-direct.c
@@ -260,7 +260,11 @@ add_drive_standard_params (guestfs_h *g, struct
backend_direct_data *data,
     append_list ("cache=unsafe");
     if (drv->disk_label)
       append_list_format ("serial=%s", drv->disk_label);
-    if (data->qemu_mandatory_locking)
+
+    /* Add the file-specific locking option only for files, as qemu
+     * won't accept options unknown to the block driver in use.
+     */
+    if (data->qemu_mandatory_locking && drv->src.protocol ==
drive_protocol_file)
       append_list ("file.backing.file.locking=off");
   }
 
-- 
2.14.3
Possibly Parallel Threads
- [PATCH] launch: direct: Use old-style file= and format= parameters when not disabling locking (RHBZ#1503497).
- [PATCH v2 5/5] launch: direct: Disable qemu locking when opening drives readonly (RHBZ#1417306).
- Re: [PATCH v2 5/5] launch: direct: Disable qemu locking when opening drives readonly (RHBZ#1417306).
- [PATCH] lib: Add direct support for the NBD (Network Block Device) protocol.
- [PATCH] fish: add option --blocksize for disks
