1 import ./make-test-python.nix ({ pkgs, ... } :
4 master = { pkgs, ... } : {
5 # data base is stored in memory
6 # server crashes with default memory size
7 virtualisation.memorySize = 1024;
9 services.moosefs.master = {
13 "* / rw,alldirs,admin,maproot=0:0"
19 chunkserver = { pkgs, ... } : {
20 virtualisation.emptyDiskImages = [ 4096 ];
21 boot.initrd.postDeviceCommands = ''
22 ${pkgs.e2fsprogs}/bin/mkfs.ext4 -L data /dev/vdb
25 fileSystems = pkgs.lib.mkVMOverride {
27 device = "/dev/disk/by-label/data";
33 masterHost = "master";
42 metalogger = { pkgs, ... } : {
44 masterHost = "master";
45 metalogger.enable = true;
49 client = { pkgs, ... } : {
50 services.moosefs.client.enable = true;
59 chunkserver1 = chunkserver;
60 chunkserver2 = chunkserver;
66 # prepare master server
68 master.wait_for_unit("multi-user.target")
69 master.succeed("mfsmaster-init")
70 master.succeed("systemctl restart mfs-master")
71 master.wait_for_unit("mfs-master.service")
73 metalogger.wait_for_unit("mfs-metalogger.service")
75 for chunkserver in [chunkserver1, chunkserver2]:
76 chunkserver.wait_for_unit("multi-user.target")
77 chunkserver.succeed("chown moosefs:moosefs /data")
78 chunkserver.succeed("systemctl restart mfs-chunkserver")
79 chunkserver.wait_for_unit("mfs-chunkserver.service")
81 for client in [client1, client2]:
82 client.wait_for_unit("multi-user.target")
83 client.succeed("mkdir /moosefs")
84 client.succeed("mount -t moosefs master:/ /moosefs")
86 client1.succeed("echo test > /moosefs/file")
87 client2.succeed("grep test /moosefs/file")