]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
centos: Only enable supported ext4 filesystem features on C8S
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 10 Mar 2023 15:07:59 +0000 (16:07 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 12 Mar 2023 18:22:03 +0000 (19:22 +0100)
Fixes #1378

mkosi/__init__.py
mkosi/distributions/__init__.py
mkosi/distributions/centos.py

index cf8bfa266a4d5ddab07df131dea09a54dacafce7..91da303a7fc34255216c140e73fb2b01aa60904e 100644 (file)
@@ -3141,8 +3141,12 @@ def invoke_repart(state: MkosiState, skip: Sequence[str] = [], split: bool = Fal
 
     cmdline += ["--definitions", definitions]
 
+    env = dict(TMPDIR=str(state.workspace))
+    for fs, options in state.installer.filesystem_options(state).items():
+        env[f"SYSTEMD_REPART_MKFS_OPTIONS_{fs.upper()}"] = " ".join(options)
+
     with complete_step("Generating disk image"):
-        output = json.loads(run(cmdline, stdout=subprocess.PIPE, env={"TMPDIR": state.workspace}).stdout)
+        output = json.loads(run(cmdline, stdout=subprocess.PIPE, env=env).stdout)
 
     roothash = usrhash = None
     for p in output:
index 1243a90251b0cc8d42460df39b4484254de85067..ded241a5951d97fb71f0084403325a2603c5e60f 100644 (file)
@@ -39,6 +39,10 @@ class DistributionInstaller:
     def filesystem(cls) -> str:
         raise NotImplementedError
 
+    @classmethod
+    def filesystem_options(cls, state: "MkosiState") -> dict[str, list[str]]:
+        return {}
+
     @staticmethod
     def kernel_command_line(state: "MkosiState") -> list[str]:
         return []
index e821dc17f7da7b1fc06c17640cc719f184daa5a6..7a9cb6ddacad9fbfa08f9594b19d541d3162b0df 100644 (file)
@@ -38,6 +38,18 @@ class CentosInstaller(DistributionInstaller):
         # https://marc.info/?l=linux-xfs&m=167450838316386&w=2.
         return "ext4"
 
+    @classmethod
+    def filesystem_options(cls, state: MkosiState) -> dict[str, list[str]]:
+        # Hard code the features from /etc/mke2fs.conf from CentOS 8 Stream to ensure that filesystems
+        # created on distros with newer versions of e2fsprogs are compatible with e2fsprogs from CentOS
+        # Stream 8.
+
+        return {
+            "8": {
+                "ext4": ["-O", "none,has_journal,extent,huge_file,flex_bg,metadata_csum,64bit,dir_nlink,extra_isize"],
+            },
+        }.get(state.config.release, {})
+
     @staticmethod
     def kernel_command_line(state: MkosiState) -> list[str]:
         kcl = []