From 564f36a437fea0203da2152fa8773f8083726676 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: May 18 2021 00:40:14 +0000 Subject: Enable Btrfs for CentOS Hyperscale SIG --- diff --git a/SOURCES/1001-apply-compression-settings-from-blivet.flags.btrfs_c.patch b/SOURCES/1001-apply-compression-settings-from-blivet.flags.btrfs_c.patch new file mode 100644 index 0000000..70c3bb3 --- /dev/null +++ b/SOURCES/1001-apply-compression-settings-from-blivet.flags.btrfs_c.patch @@ -0,0 +1,56 @@ +From 724855ff0c30eacab3448f66c6076151ed565e89 Mon Sep 17 00:00:00 2001 +From: Michel Alexandre Salim +Date: Mon, 15 Feb 2021 20:55:18 -0800 +Subject: [PATCH] apply compression settings from + blivet.flags.btrfs_compression (#1926892) + +If `blivet.flags.btrfs_compression` is set, and unless `compress=` is +already explicitly set, apply it to mount options. + +Signed-off-by: Michel Alexandre Salim +--- + blivet/devices/btrfs.py | 7 +++++++ + blivet/flags.py | 4 ++++ + 2 files changed, 11 insertions(+) + +diff --git a/blivet/devices/btrfs.py b/blivet/devices/btrfs.py +index edb82478..da652af8 100644 +--- a/blivet/devices/btrfs.py ++++ b/blivet/devices/btrfs.py +@@ -494,11 +494,18 @@ class BTRFSSubVolumeDevice(BTRFSDevice): + + # propagate mount options specified for members via kickstart + opts = "subvol=%s" % self.name ++ has_compress = False + if self.volume.format.mountopts: + for opt in self.volume.format.mountopts.split(","): + # do not add members subvol spec + if not opt.startswith("subvol"): + opts += ",%s" % opt ++ if opt.startswith("compress"): ++ has_compress = True ++ ++ # add default compression settings ++ if flags.btrfs_compression and not has_compress: ++ opts += ",compress=%s" % flags.btrfs_compression + + self.format.mountopts = opts + +diff --git a/blivet/flags.py b/blivet/flags.py +index 6500be30..0140a4a5 100644 +--- a/blivet/flags.py ++++ b/blivet/flags.py +@@ -81,6 +81,10 @@ class Flags(object): + + self.update_from_boot_cmdline() + self.allow_imperfect_devices = True ++ ++ # compression option for btrfs filesystems ++ self.btrfs_compression = None ++ + self.debug_threads = False + + def get_boot_cmdline(self): +-- +2.31.1 + diff --git a/SOURCES/1002-Try-to-get-Btrfs-volume-UUID-using-libblockdev-if-UD.patch b/SOURCES/1002-Try-to-get-Btrfs-volume-UUID-using-libblockdev-if-UD.patch new file mode 100644 index 0000000..b29efd7 --- /dev/null +++ b/SOURCES/1002-Try-to-get-Btrfs-volume-UUID-using-libblockdev-if-UD.patch @@ -0,0 +1,33 @@ +From ba7abffac92a4c9dfe0f1a57480a284cfec9a294 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Thu, 25 Feb 2021 13:46:00 +0100 +Subject: [PATCH] Try to get Btrfs volume UUID using libblockdev if UDev lookup + fails + +Resolves: rhbz#1860602 +--- + blivet/devices/btrfs.py | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/blivet/devices/btrfs.py b/blivet/devices/btrfs.py +index da652af8..bad8fcd2 100644 +--- a/blivet/devices/btrfs.py ++++ b/blivet/devices/btrfs.py +@@ -430,6 +430,14 @@ class BTRFSVolumeDevice(BTRFSDevice, ContainerDevice, RaidDevice): + else: + self.format.vol_uuid = udev.device_get_uuid(info) + ++ if not self.format.vol_uuid: ++ try: ++ bd_info = blockdev.btrfs.filesystem_info(self.parents[0].path) ++ except blockdev.BtrfsError as e: ++ log.error("failed to get filesystem info for new btrfs volume %s", e) ++ else: ++ self.format.vol_uuid = bd_info.uuid ++ + self.format.exists = True + self.original_format.exists = True + +-- +2.31.1 + diff --git a/SPECS/python-blivet.spec b/SPECS/python-blivet.spec index ed6240c..74f8534 100644 --- a/SPECS/python-blivet.spec +++ b/SPECS/python-blivet.spec @@ -23,7 +23,7 @@ Version: 3.2.2 #%%global prerelease .b2 # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 -Release: 10%{?prerelease}%{?dist} +Release: 11%{?prerelease}%{?dist} Epoch: 1 License: LGPLv2+ Group: System Environment/Libraries @@ -52,6 +52,11 @@ Patch17: 0018-Fix-possible-UnicodeDecodeError-when-reading-sysfs-a.patch Patch18: 0019-LVM-VDO-support.patch Patch19: 0020-apply-directory-s-SELinux-context-to-freshly-created.patch +## Hyperscale changes +### Backports from upstream blivet +Patch1001: 1001-apply-compression-settings-from-blivet.flags.btrfs_c.patch +Patch1002: 1002-Try-to-get-Btrfs-volume-UUID-using-libblockdev-if-UD.patch + # Versions of required components (done so we make sure the buildrequires # match the requires versions of things). %global partedver 1.8.1 @@ -181,6 +186,11 @@ configuration. %autosetup -n %{realname}-%{realversion} -N %autosetup -n %{realname}-%{realversion} -b1 -p1 +%if 0%{?centos_hs} +# Restore Btrfs support for Hyperscale +%patch1 -p1 -R +%endif + %build %{?with_python2:make PYTHON=%{__python2}} %{?with_python3:make PYTHON=%{__python3}} @@ -212,6 +222,9 @@ configuration. %endif %changelog +* Mon May 17 2021 Neal Gompa - 3.2.2-11 +- Enable Btrfs for CentOS Hyperscale SIG + * Mon Mar 08 2021 Vojtech Trefny - 3.2.2-10 - apply directory's SELinux context to freshly created mount points Resolves: rhbz#1934076