import CS python-blivet-3.6.0-23.el9_6

This commit is contained in:
eabdullin 2025-03-31 09:49:36 +00:00
parent b81b9ddd80
commit ad654463db
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,39 @@
From dd0ac302f2afcbbf4fd455416850a97a11d2d1b5 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Mon, 10 Mar 2025 09:52:27 +0100
Subject: [PATCH] Set persitent allow-discards flag for newly created LUKS
devices
We are currently using the "allow-discards" in /etc/crypttab to
set the discards/fstrim feature for LUKS, but that doesn't work
for Fedora Silverblue so we need to set the persistent flag in the
LUKS header instead.
Resolves: RHEL-82430
---
blivet/formats/luks.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/blivet/formats/luks.py b/blivet/formats/luks.py
index adf3c7112..4fc6b1342 100644
--- a/blivet/formats/luks.py
+++ b/blivet/formats/luks.py
@@ -336,7 +336,18 @@ def _create(self, **kwargs):
def _post_create(self, **kwargs):
super(LUKS, self)._post_create(**kwargs)
+
+ if self.luks_version == "luks2" and flags.discard_new:
+ try:
+ blockdev.crypto.luks_set_persistent_flags(self.device,
+ blockdev.CryptoLUKSPersistentFlags.ALLOW_DISCARDS)
+ except blockdev.CryptoError as e:
+ raise LUKSError("Failed to set allow discards flag for newly created LUKS format: %s" % str(e))
+ except AttributeError:
+ log.warning("Cannot set allow discards flag: not supported")
+
self.uuid = blockdev.crypto.luks_uuid(self.device)
+
if not self.map_name:
self.map_name = "luks-%s" % self.uuid

View File

@ -23,7 +23,7 @@ Version: 3.6.0
#%%global prerelease .b2
# prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2
Release: 22%{?prerelease}%{?dist}
Release: 23%{?prerelease}%{?dist}
Epoch: 1
License: LGPLv2+
%global realname blivet
@ -61,6 +61,7 @@ Patch27: 0028-Fix-checking-for-NVMe-plugin-availability.patch
Patch28: 0029-Align-sizes-up-for-growable-LVs.patch
Patch29: 0030-mod_pass_in_stratis_test.patch
Patch30: 0031-Fix_running_tests_in_FIPS_mode.patch
Patch31: 0032-Set-persistent-allow-discards-flag-for-new-LUKS-devices.patch
# Versions of required components (done so we make sure the buildrequires
# match the requires versions of things).
@ -224,6 +225,10 @@ configuration.
%endif
%changelog
* Tue Mar 11 2025 Vojtech Trefny <vtrefny@redhat.com> - 3.6.0-23
- Set persistent allow-discards flag for newly created LUKS devices
Resolves: RHEL-82430
* Tue Nov 12 2024 Vojtech Trefny <vtrefny@redhat.com> - 3.6.0-22
- Fix running tests in FIPS mode
Resolves: RHEL-8029