filesystem: swap options

Under some plymouth configs, cryptsetup shows warnings on boot for
underspecified cryptoswap options.  This makes the warnings go away, but
we've hardcoded some options that may change in the future.

LP: #2063252
This commit is contained in:
Dan Bungert 2024-04-25 17:01:32 -06:00
parent 26bc08b694
commit 3f2529bc49
2 changed files with 11 additions and 2 deletions

View File

@ -180,11 +180,19 @@ class FilesystemManipulator:
delete_lvm_partition = delete_logical_volume
cryptoswap_options = [
"cipher=aes-cbc-essiv:sha256",
"initramfs",
"plain",
"size=256",
"swap",
]
def create_cryptoswap(self, device):
dmc = self.model.add_dm_crypt(
device,
keyfile="/dev/urandom",
options=["swap", "initramfs"],
options=self.cryptoswap_options,
)
self.create_filesystem(dmc, dict(fstype="swap"))
return dmc

View File

@ -466,6 +466,7 @@ class TestGuided(IsolatedAsyncioTestCase):
self.controller = FilesystemController(self.app)
self.controller.supports_resilient_boot = True
self.controller._examine_systems_task.start_sync()
self.controller.cryptoswap_options = ["a", "b"]
self.app.dr_cfg = DRConfig()
self.app.base_model.source.current.type = "fsimage"
self.app.base_model.source.current.variations = {
@ -657,7 +658,7 @@ class TestGuided(IsolatedAsyncioTestCase):
self.assertIsNone(swap.fs())
[dmc] = self.model.all_dm_crypts()
self.assertEqual("/dev/urandom", dmc.keyfile)
self.assertEqual(["swap", "initramfs"], dmc.options)
self.assertEqual(["a", "b"], dmc.options)
self.assertEqual("swap", dmc.fs().fstype)
[rpool] = self.model._all(type="zpool", pool="rpool")
self.assertIsNone(rpool.path)