1 import ./make-test-python.nix ({ ... } :
4 server = { pkgs, ... } : {
5 networking.firewall.allowedTCPPorts = [ 3334 ];
6 boot.initrd.postDeviceCommands = ''
7 ${pkgs.e2fsprogs}/bin/mkfs.ext4 -L data /dev/vdb
10 virtualisation.emptyDiskImages = [ 4096 ];
12 virtualisation.fileSystems =
14 { device = "/dev/disk/by-label/data";
19 services.orangefs.server = {
21 dataStorageSpace = "/data/storage";
22 metadataStorageSpace = "/data/meta";
24 server1 = "tcp://server1:3334";
25 server2 = "tcp://server2:3334";
30 client = { lib, ... } : {
31 networking.firewall.enable = true;
33 services.orangefs.client = {
36 target = "tcp://server1:3334/orangefs";
37 mountPoint = "/orangefs";
55 for server in server1, server2:
57 server.wait_for_unit("multi-user.target")
58 server.succeed("mkdir -p /data/storage /data/meta")
59 server.succeed("chown orangefs:orangefs /data/storage /data/meta")
60 server.succeed("chmod 0770 /data/storage /data/meta")
62 "sudo -g orangefs -u orangefs pvfs2-server -f /etc/orangefs/server.conf"
65 # start services after storage is formatted on all machines
66 for server in server1, server2:
67 server.succeed("systemctl start orangefs-server.service")
69 with subtest("clients can reach and mount the FS"):
70 for client in client1, client2:
72 client.wait_for_unit("orangefs-client.service")
73 # Both servers need to be reachable
74 client.succeed("pvfs2-check-server -h server1 -f orangefs -n tcp -p 3334")
75 client.succeed("pvfs2-check-server -h server2 -f orangefs -n tcp -p 3334")
76 client.wait_for_unit("orangefs.mount")
78 with subtest("R/W test between clients"):
79 client1.succeed("echo test > /orangefs/file1")
80 client2.succeed("grep test /orangefs/file1")