launch: direct: Omit locking option for non-file disks
authorHilko Bengen <bengen@debian.org>
Tue, 23 Jan 2018 08:31:30 +0000 (09:31 +0100)
committerHilko Bengen <bengen@debian.org>
Tue, 23 Jan 2018 08:36:18 +0000 (08:36 +0000)
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.

Based on 35320dd0edb94d09d231bcded57aa883a5e7c784

Gbp-Pq: Name 0011-launch-direct-Omit-locking-option-for-non-file-disks.patch

lib/launch-direct.c

index 9cc153b21b71e427daa6d6c2caae654b61261f27..92051b9dafef0840731fe695af7980077255b56c 100644 (file)
@@ -534,7 +534,8 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
          escaped_file,
          drv->disk_label ? ",serial=" : "",
          drv->disk_label ? drv->disk_label : "",
-         data->qemu_mandatory_locking ? ",file.backing.file.locking=off" : "",
+         (data->qemu_mandatory_locking && drv->src.protocol == drive_protocol_file) ?
+         ",file.backing.file.locking=off" : "",
          i);
     }