Refresh btrfs support patch to fix autopart

This commit is contained in:
Andrew Lukoshko 2025-06-27 14:12:37 +00:00
parent cb8f12de4f
commit 70fe686c34
4 changed files with 129 additions and 165 deletions

View File

@ -17,8 +17,5 @@ actions:
- add_files:
- type: "patch"
name: "0001-btrfs-Restore-support-for-the-btrfs-command-on-RHEL.patch"
name: "0001-btrfs-Restore-support-for-Btrfs-on-RHEL10.patch"
number: 1001
- type: "patch"
name: "0002-Revert-rhel10-autopart-on-RHEL-does-not-support-typ.patch"
number: 1002

View File

@ -0,0 +1,128 @@
From 9cce119c569e40876793daa53a2798c9c6bb0439 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa@centosproject.org>
Date: Thu, 26 Jun 2025 23:51:33 -0400
Subject: [PATCH] btrfs: Restore support for Btrfs on RHEL10
Red Hat Enterprise Linux and baseline CentOS Stream have
removed support for Btrfs, but we need it back for CentOS Hyperscale.
---
pykickstart/commands/autopart.py | 32 +-------------------------------
pykickstart/commands/btrfs.py | 9 +++------
tests/commands/autopart.py | 3 +--
tests/commands/btrfs.py | 7 ++-----
4 files changed, 7 insertions(+), 44 deletions(-)
diff --git a/pykickstart/commands/autopart.py b/pykickstart/commands/autopart.py
index d7b5c072..3e77e4f6 100644
--- a/pykickstart/commands/autopart.py
+++ b/pykickstart/commands/autopart.py
@@ -599,34 +599,4 @@ class F38_AutoPart(F29_AutoPart):
return retval
class RHEL10_AutoPart(F38_AutoPart):
- removedKeywords = F38_AutoPart.removedKeywords
- removedAttrs = F38_AutoPart.removedAttrs
-
- def parse(self, args):
- # call the overriden command to do it's job first
- retval = F38_AutoPart.parse(self, args)
-
- # btrfs is no more supported
- if self._typeAsStr() == "btrfs":
- raise KickstartParseError(_("autopart --type=btrfs is not supported"),
- lineno=self.lineno)
-
- return retval
-
- def _getParser(self):
- "Only necessary for the type change documentation"
- op = F38_AutoPart._getParser(self)
- for action in op._actions:
- if "--type" in action.option_strings:
- action.help += """
-
- .. versionchanged:: %s
-
- Partitioning scheme 'btrfs' was removed.""" % versionToLongString(RHEL8)
- if "--fstype" in action.option_strings:
- action.help += """
-
- .. versionchanged:: %s
-
- Partitioning scheme 'btrfs' was removed.""" % versionToLongString(RHEL8)
- return op
+ pass
diff --git a/pykickstart/commands/btrfs.py b/pykickstart/commands/btrfs.py
index ac22c71f..a2825bf6 100644
--- a/pykickstart/commands/btrfs.py
+++ b/pykickstart/commands/btrfs.py
@@ -19,7 +19,7 @@
# with the express permission of Red Hat, Inc.
#
from pykickstart.version import F17, F23, RHEL8, RHEL10, versionToLongString
-from pykickstart.base import BaseData, KickstartCommand, DeprecatedCommand, RemovedCommand
+from pykickstart.base import BaseData, KickstartCommand, DeprecatedCommand
from pykickstart.errors import KickstartParseError, KickstartParseWarning
from pykickstart.options import KSOptionParser, mountpoint
@@ -280,8 +280,5 @@ class RHEL8_BTRFS(DeprecatedCommand, F23_BTRFS):
class RHEL9_BTRFS(RHEL8_BTRFS):
pass
-class RHEL10_BTRFS(RemovedCommand, RHEL8_BTRFS):
- def _getParser(self):
- op = RHEL8_BTRFS._getParser(self)
- op.description += "\n\n.. versionremoved:: %s" % versionToLongString(RHEL10)
- return op
+class RHEL10_BTRFS(F23_BTRFS):
+ pass
diff --git a/tests/commands/autopart.py b/tests/commands/autopart.py
index e7e8b220..81d459ee 100644
--- a/tests/commands/autopart.py
+++ b/tests/commands/autopart.py
@@ -165,7 +165,7 @@ class F17_TestCase(F16_TestCase):
self.assert_parse("autopart --type=lvm",
"autopart --type=lvm\n")
- if self.__class__.__name__ not in ["RHEL8_TestCase", "RHEL10_TestCase"]:
+ if self.__class__.__name__ not in ["RHEL8_TestCase"]:
self.assert_parse("autopart --type=btrfs",
"autopart --type=btrfs\n")
@@ -358,7 +358,6 @@ class F38_TestCase(F29_TestCase):
class RHEL10_TestCase(F38_TestCase):
def runTest(self):
F38_TestCase.runTest(self)
- self.assert_parse_error("autopart --type=btrfs")
if __name__ == "__main__":
unittest.main()
diff --git a/tests/commands/btrfs.py b/tests/commands/btrfs.py
index 8fee1f11..7e9043aa 100644
--- a/tests/commands/btrfs.py
+++ b/tests/commands/btrfs.py
@@ -20,7 +20,6 @@
import unittest
from tests.baseclass import CommandTest, CommandSequenceTest
-from pykickstart.base import RemovedCommand
from pykickstart.commands.btrfs import F17_BTRFSData, F23_BTRFSData
from pykickstart.errors import KickstartParseError, KickstartParseWarning
from pykickstart.version import F17
@@ -199,11 +198,9 @@ class RHEL7_TestCase(F23_TestCase):
def runTest(self):
F23_TestCase.runTest(self)
-class RHEL10_TestCase(RHEL7_TestCase):
+class RHEL10_TestCase(F23_TestCase):
def runTest(self):
- # make sure we've been removed
- parser = self.getParser("btrfs")
- self.assertEqual(issubclass(parser.__class__, RemovedCommand), True)
+ F23_TestCase.runTest(self)
if __name__ == "__main__":
unittest.main()
--
2.49.0

View File

@ -1,65 +0,0 @@
From 7b9c6dee2e0817f9b6513017f7e3fe9083d4f967 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa@centosproject.org>
Date: Sat, 25 Jan 2025 18:40:04 -0500
Subject: [PATCH] btrfs: Restore support for the btrfs command on RHEL10
Red Hat Enterprise Linux and baseline CentOS Stream have
removed support for Btrfs, but we need it back for CentOS Hyperscale.
---
pykickstart/commands/btrfs.py | 9 +++------
tests/commands/btrfs.py | 7 ++-----
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/pykickstart/commands/btrfs.py b/pykickstart/commands/btrfs.py
index ac22c71f..a2825bf6 100644
--- a/pykickstart/commands/btrfs.py
+++ b/pykickstart/commands/btrfs.py
@@ -19,7 +19,7 @@
# with the express permission of Red Hat, Inc.
#
from pykickstart.version import F17, F23, RHEL8, RHEL10, versionToLongString
-from pykickstart.base import BaseData, KickstartCommand, DeprecatedCommand, RemovedCommand
+from pykickstart.base import BaseData, KickstartCommand, DeprecatedCommand
from pykickstart.errors import KickstartParseError, KickstartParseWarning
from pykickstart.options import KSOptionParser, mountpoint
@@ -280,8 +280,5 @@ class RHEL8_BTRFS(DeprecatedCommand, F23_BTRFS):
class RHEL9_BTRFS(RHEL8_BTRFS):
pass
-class RHEL10_BTRFS(RemovedCommand, RHEL8_BTRFS):
- def _getParser(self):
- op = RHEL8_BTRFS._getParser(self)
- op.description += "\n\n.. versionremoved:: %s" % versionToLongString(RHEL10)
- return op
+class RHEL10_BTRFS(F23_BTRFS):
+ pass
diff --git a/tests/commands/btrfs.py b/tests/commands/btrfs.py
index 8fee1f11..7e9043aa 100644
--- a/tests/commands/btrfs.py
+++ b/tests/commands/btrfs.py
@@ -20,7 +20,6 @@
import unittest
from tests.baseclass import CommandTest, CommandSequenceTest
-from pykickstart.base import RemovedCommand
from pykickstart.commands.btrfs import F17_BTRFSData, F23_BTRFSData
from pykickstart.errors import KickstartParseError, KickstartParseWarning
from pykickstart.version import F17
@@ -199,11 +198,9 @@ class RHEL7_TestCase(F23_TestCase):
def runTest(self):
F23_TestCase.runTest(self)
-class RHEL10_TestCase(RHEL7_TestCase):
+class RHEL10_TestCase(F23_TestCase):
def runTest(self):
- # make sure we've been removed
- parser = self.getParser("btrfs")
- self.assertEqual(issubclass(parser.__class__, RemovedCommand), True)
+ F23_TestCase.runTest(self)
if __name__ == "__main__":
unittest.main()
--
2.48.0

View File

@ -1,96 +0,0 @@
From 3a795ad4b0d49bef2ee1d8fab080ec79d356593e Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa@centosproject.org>
Date: Thu, 26 Jun 2025 00:52:22 -0400
Subject: [PATCH] Revert "rhel10: autopart on RHEL does not support
--type=btrfs"
This restores Btrfs support for the autopart kickstart command.
This reverts commit 8e24a29588b2c18f9e47a05d8be5c1cd654179a7.
---
pykickstart/commands/autopart.py | 33 --------------------------------
pykickstart/handlers/rhel10.py | 2 +-
tests/commands/autopart.py | 7 +------
3 files changed, 2 insertions(+), 40 deletions(-)
diff --git a/pykickstart/commands/autopart.py b/pykickstart/commands/autopart.py
index d7b5c072..382cc3a2 100644
--- a/pykickstart/commands/autopart.py
+++ b/pykickstart/commands/autopart.py
@@ -597,36 +597,3 @@ class F38_AutoPart(F29_AutoPart):
raise KickstartParseError(msg, lineno=self.lineno)
return retval
-
-class RHEL10_AutoPart(F38_AutoPart):
- removedKeywords = F38_AutoPart.removedKeywords
- removedAttrs = F38_AutoPart.removedAttrs
-
- def parse(self, args):
- # call the overriden command to do it's job first
- retval = F38_AutoPart.parse(self, args)
-
- # btrfs is no more supported
- if self._typeAsStr() == "btrfs":
- raise KickstartParseError(_("autopart --type=btrfs is not supported"),
- lineno=self.lineno)
-
- return retval
-
- def _getParser(self):
- "Only necessary for the type change documentation"
- op = F38_AutoPart._getParser(self)
- for action in op._actions:
- if "--type" in action.option_strings:
- action.help += """
-
- .. versionchanged:: %s
-
- Partitioning scheme 'btrfs' was removed.""" % versionToLongString(RHEL8)
- if "--fstype" in action.option_strings:
- action.help += """
-
- .. versionchanged:: %s
-
- Partitioning scheme 'btrfs' was removed.""" % versionToLongString(RHEL8)
- return op
diff --git a/pykickstart/handlers/rhel10.py b/pykickstart/handlers/rhel10.py
index 3e67dc55..93926f34 100644
--- a/pykickstart/handlers/rhel10.py
+++ b/pykickstart/handlers/rhel10.py
@@ -28,7 +28,7 @@ class RHEL10Handler(BaseHandler):
"auth": commands.authconfig.F35_Authconfig, # RemovedCommand
"authconfig": commands.authconfig.F35_Authconfig, # RemovedCommand
"authselect": commands.authselect.F28_Authselect,
- "autopart": commands.autopart.RHEL10_AutoPart,
+ "autopart": commands.autopart.F38_AutoPart,
"autostep": commands.autostep.F40_Autostep, # RemovedCommand
"bootloader": commands.bootloader.F39_Bootloader,
"btrfs": commands.btrfs.RHEL10_BTRFS,
diff --git a/tests/commands/autopart.py b/tests/commands/autopart.py
index e7e8b220..5ae7281d 100644
--- a/tests/commands/autopart.py
+++ b/tests/commands/autopart.py
@@ -165,7 +165,7 @@ class F17_TestCase(F16_TestCase):
self.assert_parse("autopart --type=lvm",
"autopart --type=lvm\n")
- if self.__class__.__name__ not in ["RHEL8_TestCase", "RHEL10_TestCase"]:
+ if self.__class__.__name__ != "RHEL8_TestCase":
self.assert_parse("autopart --type=btrfs",
"autopart --type=btrfs\n")
@@ -355,10 +355,5 @@ class F38_TestCase(F29_TestCase):
"autopart --hibernation\n")
self.assert_parse_error("autopart --hibernation --noswap")
-class RHEL10_TestCase(F38_TestCase):
- def runTest(self):
- F38_TestCase.runTest(self)
- self.assert_parse_error("autopart --type=btrfs")
-
if __name__ == "__main__":
unittest.main()
--
2.49.0