neil / rpms / python-blivet

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