zengxyz / rpms / anaconda

Forked from rpms/anaconda 4 months ago
Clone
cebaad
From ab2ee2d89ed127fcd59326bec85a9404dbbaa425 Mon Sep 17 00:00:00 2001
cebaad
From: Michel Alexandre Salim <michel@michel-slm.name>
cebaad
Date: Tue, 16 Feb 2021 18:39:29 -0800
4c654f
Subject: [PATCH 20005/20007] [Storage] add btrfs_compression option
cebaad
cebaad
This is a new option to allow specifying the compression algorithm and
cebaad
level for Btrfs filesystems. If set, it will be passed to Blivet and
cebaad
applied when mounting Btrfs filesystems.
cebaad
cebaad
Default this to None, but set it to "zstd:1" for CentOS Stream Hyperscale.
cebaad
cebaad
(cherry picked from commit 15e06b6aa9876d55dedaa9c37f2f589361de8949)
cebaad
---
cebaad
 anaconda.spec.in                             |  3 ++-
cebaad
 data/anaconda.conf                           |  3 +++
cebaad
 data/product.d/centos-stream-hyperscale.conf |  1 +
cebaad
 pyanaconda/core/configuration/storage.py     | 11 +++++++++++
cebaad
 pyanaconda/modules/storage/initialization.py |  1 +
cebaad
 5 files changed, 18 insertions(+), 1 deletion(-)
cebaad
cebaad
diff --git a/anaconda.spec.in b/anaconda.spec.in
cebaad
index bd7d74eac..471093c17 100644
cebaad
--- a/anaconda.spec.in
cebaad
+++ b/anaconda.spec.in
cebaad
@@ -35,6 +35,7 @@ Source0: %{name}-%{version}.tar.bz2
cebaad
 %define nmver 1.0
cebaad
 %define pykickstartver 3.16.11-1
cebaad
 %define pypartedver 2.5-2
cebaad
+%define pythonblivetver 1:3.2.2-11
cebaad
 %define rpmver 4.10.0
cebaad
 %define simplelinever 1.1-1
cebaad
 %define utillinuxver 2.15.1
cebaad
@@ -81,7 +82,7 @@ The anaconda package is a metapackage for the Anaconda installer.
cebaad
 Summary: Core of the Anaconda installer
cebaad
 Requires: python3-libs
cebaad
 Requires: python3-dnf >= %{dnfver}
cebaad
-Requires: python3-blivet >= 1:3.2.2-1
cebaad
+Requires: python3-blivet >= %{pythonblivetver}
cebaad
 Requires: python3-blockdev >= %{libblockdevver}
cebaad
 Requires: python3-meh >= %{mehver}
cebaad
 Requires: libreport-anaconda >= 2.0.21-1
cebaad
diff --git a/data/anaconda.conf b/data/anaconda.conf
cebaad
index 1508a7a8a..c84881091 100644
cebaad
--- a/data/anaconda.conf
cebaad
+++ b/data/anaconda.conf
cebaad
@@ -156,6 +156,9 @@ multipath_friendly_names = True
cebaad
 # Do you want to allow imperfect devices (for example, degraded mdraid array devices)?
cebaad
 allow_imperfect_devices = False
cebaad
 
cebaad
+# Btrfs compression algorithm and level. e.g. zstd:1
cebaad
+btrfs_compression =
cebaad
+
cebaad
 # Default file system type. Use whatever Blivet uses by default.
cebaad
 file_system_type =
cebaad
 
cebaad
diff --git a/data/product.d/centos-stream-hyperscale.conf b/data/product.d/centos-stream-hyperscale.conf
cebaad
index 88979adb5..226359344 100644
cebaad
--- a/data/product.d/centos-stream-hyperscale.conf
cebaad
+++ b/data/product.d/centos-stream-hyperscale.conf
cebaad
@@ -9,6 +9,7 @@ product_name = CentOS Stream
cebaad
 
cebaad
 [Storage]
cebaad
 default_scheme = BTRFS
cebaad
+btrfs_compression = zstd:1
cebaad
 
cebaad
 [Payload]
cebaad
 # RHEL removes btrfs-progs, but we want it back
cebaad
diff --git a/pyanaconda/core/configuration/storage.py b/pyanaconda/core/configuration/storage.py
cebaad
index 29f554ed5..4dcbadbba 100644
cebaad
--- a/pyanaconda/core/configuration/storage.py
cebaad
+++ b/pyanaconda/core/configuration/storage.py
cebaad
@@ -82,6 +82,17 @@ class StorageSection(Section):
cebaad
         """
cebaad
         return self._get_option("allow_imperfect_devices", bool)
cebaad
 
cebaad
+    @property
cebaad
+    def btrfs_compression(self):
cebaad
+        """BTRFS compression setting.
cebaad
+
cebaad
+        Specifies the compression algorithm and level used when
cebaad
+        mounting Btrfs partitions. Defaults to None.
cebaad
+
cebaad
+        For example: "zstd:1"
cebaad
+        """
cebaad
+        return self._get_option("btrfs_compression", str) or None
cebaad
+
cebaad
     @property
cebaad
     def file_system_type(self):
cebaad
         """Default file system type.
cebaad
diff --git a/pyanaconda/modules/storage/initialization.py b/pyanaconda/modules/storage/initialization.py
cebaad
index cb2488a31..6b2838ead 100644
cebaad
--- a/pyanaconda/modules/storage/initialization.py
cebaad
+++ b/pyanaconda/modules/storage/initialization.py
cebaad
@@ -52,6 +52,7 @@ def enable_installer_mode():
cebaad
     blivet_flags.ibft = conf.storage.ibft
cebaad
     blivet_flags.multipath_friendly_names = conf.storage.multipath_friendly_names
cebaad
     blivet_flags.allow_imperfect_devices = conf.storage.allow_imperfect_devices
cebaad
+    blivet_flags.btrfs_compression = conf.storage.btrfs_compression
cebaad
 
cebaad
     # Platform class setup depends on flags, re-initialize it.
cebaad
     platform.update_from_flags()
cebaad
-- 
cebaad
2.31.1
cebaad