Specify backing format for qemu 6.1

resolves: rhbz#1999419
This commit is contained in:
Richard W.M. Jones 2021-09-14 12:32:48 +01:00
parent 8b5d662685
commit 61eede1ba3
8 changed files with 67 additions and 13 deletions

View File

@ -0,0 +1,49 @@
From 6be87872732ca8e298152a9eeebde151fe2bd4a2 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 31 Aug 2021 08:27:15 +0100
Subject: [PATCH] lib: Autodetect backing format for qemu-img create -b
qemu 6.1 has decided to change qemu-img create so that a backing
format (-F) is required if a backing file (-b) is specified. Since we
don't want to change the libguestfs API to force callers to specify
this because that would be an API break, autodetect it.
This is similar to commit c8c181e8d9 ("launch: libvirt: Autodetect
backing format for readonly drive overlays").
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1998820
(cherry picked from commit 45de287447bb18d59749fbfc1ec5072413090109)
---
lib/create.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lib/create.c b/lib/create.c
index 44a7df25f..75a4d3a28 100644
--- a/lib/create.c
+++ b/lib/create.c
@@ -255,6 +255,7 @@ disk_create_qcow2 (guestfs_h *g, const char *filename, int64_t size,
const struct guestfs_disk_create_argv *optargs)
{
const char *backingformat = NULL;
+ CLEANUP_FREE char *backingformat_free = NULL;
const char *preallocation = NULL;
const char *compat = NULL;
int clustersize = -1;
@@ -270,6 +271,14 @@ disk_create_qcow2 (guestfs_h *g, const char *filename, int64_t size,
return -1;
}
}
+ else if (backingfile) {
+ /* Since qemu 6.1, qemu-img create has requires a backing format (-F)
+ * parameter if backing file (-b) is used (RHBZ#1998820).
+ */
+ backingformat = backingformat_free = guestfs_disk_format (g, backingfile);
+ if (!backingformat)
+ return -1;
+ }
if (optargs->bitmask & GUESTFS_DISK_CREATE_PREALLOCATION_BITMASK) {
if (STREQ (optargs->preallocation, "off") ||
STREQ (optargs->preallocation, "sparse"))
--
2.31.1

View File

@ -1,4 +1,4 @@
From 53efe7ddea016a3d27f39af3ea0445e0b1d234be Mon Sep 17 00:00:00 2001
From 9dc4c156eef3ad0eb62aa50acbc4198fd1e335cc Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 21 Dec 2012 15:50:11 +0000
Subject: [PATCH] RHEL: Remove libguestfs live (RHBZ#798980).

View File

@ -1,4 +1,4 @@
From 9594b98014ac1dfdfc652d41f4eba38e510c00fe Mon Sep 17 00:00:00 2001
From 421f0716461427ec1deddaea3e51ba6ba7ccf71c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 18 Jul 2013 18:31:53 +0100
Subject: [PATCH] RHEL: Remove 9p APIs from RHEL (RHBZ#921710).

View File

@ -1,4 +1,4 @@
From 3f8f68460ffadca3af181cb7c2b0495b85b53f82 Mon Sep 17 00:00:00 2001
From b7007f7b1524c8f5d001eda10ebf040b0ae4ca43 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 29 Jul 2013 14:47:56 +0100
Subject: [PATCH] RHEL: Disable unsupported remote drive protocols

View File

@ -1,4 +1,4 @@
From 0d0c34cba36156e0205cf7ad7d419c8be0ba99cf Mon Sep 17 00:00:00 2001
From dbca97559bc6d44d91dafbf3b7435a0d909fb6fa Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 19 Sep 2014 13:38:20 +0100
Subject: [PATCH] RHEL: Remove User-Mode Linux (RHBZ#1144197).

View File

@ -1,4 +1,4 @@
From 3508207fa46f45d5bdd0125f04790428e74aed48 Mon Sep 17 00:00:00 2001
From b7dd5ace0488cfa0b9caa3ea673edb13324d806e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 7 Jul 2015 09:28:03 -0400
Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for

View File

@ -1,4 +1,4 @@
From 6c98e1924ff73ee5c9361d0ff83d656ac8ee0e77 Mon Sep 17 00:00:00 2001
From fa865ee05a6269c46b1cd2fe5311ac6663260e29 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 29 Jun 2021 15:29:11 +0100
Subject: [PATCH] RHEL: Create /etc/crypto-policies/back-ends/opensslcnf.config

View File

@ -57,7 +57,7 @@ Summary: Access and modify virtual machine disk images
Name: libguestfs
Epoch: 1
Version: 1.45.6
Release: 13%{?dist}
Release: 14%{?dist}
License: LGPLv2+
# Build only for architectures that have a kernel
@ -99,15 +99,16 @@ Patch0001: 0001-build-Don-t-use-non-POSIX-tests.patch
Patch0002: 0002-python-Don-t-leak-fields-when-creating-Python-struct.patch
Patch0003: 0003-appliance-Add-IBM850-iconv-converter-for-syslinux.patch
Patch0004: 0004-lib-direct-Remove-use-of-sga.patch
Patch0005: 0005-lib-Autodetect-backing-format-for-qemu-img-create-b.patch
# Downstream (RHEL-only) patches.
%if 0%{?rhel}
Patch0005: 0005-RHEL-Remove-libguestfs-live-RHBZ-798980.patch
Patch0006: 0006-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch
Patch0007: 0007-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch
Patch0008: 0008-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch
Patch0009: 0009-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch
Patch0010: 0010-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.patch
Patch0006: 0006-RHEL-Remove-libguestfs-live-RHBZ-798980.patch
Patch0007: 0007-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch
Patch0008: 0008-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch
Patch0009: 0009-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch
Patch0010: 0010-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch
Patch0011: 0011-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.patch
%endif
%if 0%{patches_touch_autotools}
@ -1147,6 +1148,10 @@ rm ocaml/html/.gitignore
%changelog
* Tue Sep 14 2021 Richard W.M. Jones <rjones@redhat.com> - 1:1.45.6-14
- Specify backing format for qemu 6.1
resolves: rhbz#1999419
* Mon Sep 13 2021 Richard W.M. Jones <rjones@redhat.com> - 1:1.45.6-13
- Remove use of sga
resolves: rhbz#2002325