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
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);
}