From b3901f5d4a2b6307e7ac9d0b5c1243514915ece9 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 3 Dec 2017 19:28:36 +0000 Subject: [PATCH] Fix locking on NBD drives. --- ...it-locking-option-for-non-file-disks.patch | 36 +++++++++++++++++++ libguestfs.spec | 8 ++++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 0001-launch-direct-Omit-locking-option-for-non-file-disks.patch diff --git a/0001-launch-direct-Omit-locking-option-for-non-file-disks.patch b/0001-launch-direct-Omit-locking-option-for-non-file-disks.patch new file mode 100644 index 0000000..47b7294 --- /dev/null +++ b/0001-launch-direct-Omit-locking-option-for-non-file-disks.patch @@ -0,0 +1,36 @@ +From 35320dd0edb94d09d231bcded57aa883a5e7c784 Mon Sep 17 00:00:00 2001 +From: Lars Seipel +Date: Thu, 23 Nov 2017 06:15:28 +0100 +Subject: [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 +--- + 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 87ac121c7..678c8c68d 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.15.1 + diff --git a/libguestfs.spec b/libguestfs.spec index 51d33be..b1f8a65 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -36,7 +36,7 @@ Summary: Access and modify virtual machine disk images Name: libguestfs Epoch: 1 Version: 1.37.34 -Release: 2%{?dist} +Release: 3%{?dist} License: LGPLv2+ # Source and patches. @@ -60,6 +60,9 @@ Source6: yum.conf.in Source7: libguestfs.keyring %endif +# Upstream patch to fix locking on NBD drives. +Patch1: 0001-launch-direct-Omit-locking-option-for-non-file-disks.patch + # Basic build requirements for the library and virt tools. BuildRequires: gcc BuildRequires: supermin-devel >= 5.1.18 @@ -1391,6 +1394,9 @@ install -m 0644 utils/boot-benchmark/boot-benchmark.1 $RPM_BUILD_ROOT%{_mandir}/ %changelog +* Sun Dec 3 2017 Richard W.M. Jones - 1:1.37.34-3 +- Fix locking on NBD drives. + * Fri Nov 17 2017 Richard W.M. Jones - 1:1.37.34-2 - OCaml 4.06.0 rebuild.