3
0
Fork 0
forked from mirrors/nixpkgs

nixos/tests/lvm2/thinpool: fix xfs creation on older kernels

This commit is contained in:
ajs124 2023-06-09 13:44:48 +02:00
parent 3bf06829ff
commit bcb903cce8

View file

@ -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")