5 import ../make-test-python.nix (
8 name = "lvm2-thinpool";
9 meta.maintainers = lib.teams.helsinki-systems.members;
14 virtualisation.emptyDiskImages = [ 4096 ];
16 boot.thin.enable = true;
17 dmeventd.enable = true;
19 environment.systemPackages = with pkgs; [ xfsprogs ];
20 environment.etc."lvm/lvm.conf".text = ''
21 activation/thin_pool_autoextend_percent = 10
22 activation/thin_pool_autoextend_threshold = 80
24 boot = lib.mkIf (kernelPackages != null) { inherit kernelPackages; };
30 lib.optionalString (lib.versionOlder kernelPackages.kernel.version "5.10") " -m bigtime=0 -m inobtcount=0 "
31 + lib.optionalString (lib.versionOlder kernelPackages.kernel.version "5.19") " -i nrext64=0 ";
34 machine.succeed("vgcreate test_vg /dev/vdb")
35 machine.succeed("lvcreate -L 512M -T test_vg/test_thin_pool")
36 machine.succeed("lvcreate -n test_lv -V 16G --thinpool test_thin_pool test_vg")
37 machine.succeed("mkfs.xfs ${mkXfsFlags} /dev/test_vg/test_lv")
38 machine.succeed("mkdir /mnt; mount /dev/test_vg/test_lv /mnt")
39 assert "/dev/mapper/test_vg-test_lv" == machine.succeed("findmnt -no SOURCE /mnt").strip()
40 machine.succeed("dd if=/dev/zero of=/mnt/empty.file bs=1M count=1024")
41 machine.succeed("journalctl -u dm-event.service | grep \"successfully resized\"")
42 machine.succeed("umount /mnt")
43 machine.succeed("vgchange -a n")