python-blivet/SOURCES/0013-Do-not-limit-swap-to-128-GiB.patch
2021-09-10 02:35:50 +00:00

77 lines
2.3 KiB
Diff

From aa4ce218fe9b4ee3571d872ff1575a499596181c Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Fri, 29 May 2020 12:14:30 +0200
Subject: [PATCH 1/2] Do not limit swap to 128 GiB
The limit was part of change to limit suggested swap size in
kickstart which doesn't use the SwapSpace._max_size so there is no
reason to limit this for manual installations.
16 TiB seems to be max usable swap size based on mkswap code.
Resolves: rhbz#1656485
---
blivet/formats/swap.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/blivet/formats/swap.py b/blivet/formats/swap.py
index 4b8a7edf..3cc59138 100644
--- a/blivet/formats/swap.py
+++ b/blivet/formats/swap.py
@@ -52,8 +52,7 @@ class SwapSpace(DeviceFormat):
_linux_native = True # for clearpart
_plugin = availability.BLOCKDEV_SWAP_PLUGIN
- # see rhbz#744129 for details
- _max_size = Size("128 GiB")
+ _max_size = Size("16 TiB")
config_actions_map = {"label": "write_label"}
--
2.26.2
From 93aa6ad87116f1c86616d73dbe561251c4a0c286 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Thu, 11 Jun 2020 14:27:44 +0200
Subject: [PATCH 2/2] Add test for SwapSpace max size
---
tests/formats_test/swap_test.py | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 tests/formats_test/swap_test.py
diff --git a/tests/formats_test/swap_test.py b/tests/formats_test/swap_test.py
new file mode 100644
index 00000000..56356144
--- /dev/null
+++ b/tests/formats_test/swap_test.py
@@ -0,0 +1,24 @@
+import test_compat # pylint: disable=unused-import
+
+import six
+import unittest
+
+from blivet.devices.storage import StorageDevice
+from blivet.errors import DeviceError
+from blivet.formats import get_format
+
+from blivet.size import Size
+
+
+class SwapNodevTestCase(unittest.TestCase):
+
+ def test_swap_max_size(self):
+ StorageDevice("dev", size=Size("129 GiB"),
+ fmt=get_format("swap"))
+
+ StorageDevice("dev", size=Size("15 TiB"),
+ fmt=get_format("swap"))
+
+ with six.assertRaisesRegex(self, DeviceError, "device is too large for new format"):
+ StorageDevice("dev", size=Size("17 TiB"),
+ fmt=get_format("swap"))
--
2.26.2