From bcb903cce86402edbd8bbdea5645eef3d624a7e3 Mon Sep 17 00:00:00 2001 From: ajs124 Date: Fri, 9 Jun 2023 13:44:48 +0200 Subject: [PATCH] nixos/tests/lvm2/thinpool: fix xfs creation on older kernels --- nixos/tests/lvm2/thinpool.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nixos/tests/lvm2/thinpool.nix b/nixos/tests/lvm2/thinpool.nix index 82c6460a890a..14781a8a6045 100644 --- a/nixos/tests/lvm2/thinpool.nix +++ b/nixos/tests/lvm2/thinpool.nix @@ -1,5 +1,5 @@ { kernelPackages ? null }: -import ../make-test-python.nix ({ pkgs, ... }: { +import ../make-test-python.nix ({ pkgs, lib, ... }: { name = "lvm2-thinpool"; meta.maintainers = with pkgs.lib.maintainers; [ ajs124 ]; @@ -17,11 +17,13 @@ import ../make-test-python.nix ({ pkgs, ... }: { boot = lib.mkIf (kernelPackages != null) { inherit kernelPackages; }; }; - testScript = '' + testScript = let + mkXfsFlags = lib.optionalString (lib.versionOlder kernelPackages.kernel.version "5.10") "-m bigtime=0 -m inobtcount=0"; + in '' machine.succeed("vgcreate test_vg /dev/vdb") machine.succeed("lvcreate -L 512M -T test_vg/test_thin_pool") machine.succeed("lvcreate -n test_lv -V 16G --thinpool test_thin_pool test_vg") - machine.succeed("mkfs.xfs /dev/test_vg/test_lv") + machine.succeed("mkfs.xfs ${mkXfsFlags} /dev/test_vg/test_lv") machine.succeed("mkdir /mnt; mount /dev/test_vg/test_lv /mnt") assert "/dev/mapper/test_vg-test_lv" == machine.succeed("findmnt -no SOURCE /mnt").strip() machine.succeed("dd if=/dev/zero of=/mnt/empty.file bs=1M count=1024")