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(a)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