You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
{ pkgs, config, lib, ... }:
with lib;
{ options.hpc.beegfs = { package = mkOption { description = ''
BeeGFS package. '';
type = types.package; default = config.boot.kernelPackages.callPackage ../packages/beegfs/default.nix { }; };
mgmtdHost = mkOption { description = ''
Hostname of the management host. '';
type = types.str; };
connAuthFile = mkOption { description = ''
File containing shared secret authentication. '';
type = types.str; };
client = { enable = mkEnableOption "BeeGFS client";
mountPoint = mkOption { description = ''
Mount point under which the BeeGFS filesystem is mounted. '';
type = types.nullOr types.str; default = null; }; };
mgmtd = { enable = mkEnableOption "BeeGFS management server daemon"; };
meta = { enable = mkEnableOption "BeeGFS meta-data server daemon"; };
storage = { enable = mkEnableOption "BeeGFS storage server daemon"; }; };
config = mkMerge [ (mkIf config.hpc.beegfs.client.enable { boot.kernelModules = [ "beegfs" ]; boot.extraModulePackages = [ config.hpc.beegfs.package.module ];
environment.etc."beegfs-client" = { enable = true; target = "beegfs/client.conf"; text = ''
sysMgmtdHost = ${config.hpc.beegfs.mgmtdHost} connAuthFile = ${config.hpc.beegfs.connAuthFile} '';
};
systemd.mounts = mkIf (config.hpc.beegfs.client.mountPoint != null) [ { where = config.hpc.beegfs.client.mountPoint; what = "beegfs_nodev"; type = "beegfs"; options = "cfgFile=/etc/beegfs/client.conf,_netdev";
requires = [ "beegfs-helperd.service" ]; after = [ "beegfs-helperd.service" ]; } ];
systemd.services."beegfs-helperd" = let cfgFile = pkgs.writeText "beegfs-helperd.conf" ''
connAuthFile = ${config.hpc.beegfs.connAuthFile} logType = syslog '';
in { wantedBy = [ "multi-user.target" ]; requires = [ "network-online.target" ]; after = [ "network-online.target" ];
serviceConfig = rec { ExecStart = ''
${config.hpc.beegfs.package}/bin/beegfs-helperd \ cfgFile=${cfgFile} \ pidFile=${PIDFile} \ runDaemonized=false '';
PIDFile = "/run/beegfs-helperd.pid"; TimeoutStopSec = "300"; }; };
environment.systemPackages = [ (pkgs.runCommandLocal "beegfs-utils" { nativeBuildInputs = [ pkgs.makeWrapper ]; } ''
mkdir -p $out/bin
makeWrapper ${config.hpc.beegfs.package}/bin/beegfs-check-servers \ $out/bin/beegfs-check-servers \ --add-flags "-c /etc/beegfs/client.conf" \ --prefix PATH : ${lib.makeBinPath [ config.hpc.beegfs.package ]}
makeWrapper ${config.hpc.beegfs.package}/bin/beegfs-ctl \ $out/bin/beegfs-ctl \ --add-flags "--cfgFile=/etc/beegfs/client.conf"
makeWrapper ${config.hpc.beegfs.package}/bin/beegfs-ctl \ $out/bin/beegfs-df \ --add-flags "--cfgFile=/etc/beegfs/client.conf" \ --add-flags --listtargets \ --add-flags --hidenodeid \ --add-flags --pools \ --add-flags --spaceinfo
makeWrapper ${config.hpc.beegfs.package}/bin/fsck.beegfs \ $out/bin/beegfs-fsck \ --add-flags "--cfgFile=/etc/beegfs/client.conf" '') ];
})
(mkIf config.hpc.beegfs.mgmtd.enable (let cfgFile = pkgs.writeText "beegfs-mgmtd.conf" ''
storeMgmtdDirectory = /var/lib/beegs/mgmtd storeAllowFirstRunInit = false connAuthFile = ${config.hpc.beegfs.connAuthFile} logType = syslog '';
in { systemd.services."beegfs-mgmtd" = { wantedBy = [ "multi-user.target" ]; requires = [ "network-online.target" ]; after = [ "network-online.target" "rdma.service" "opensmd.service" "opensm.service" ];
preStart = ''
if ! test -e /var/lib/beegs/mgmtd; then ${config.hpc.beegfs.package}/bin/beegfs-setup-mgmtd -C -p /var/lib/beegs/mgmtd fi '';
serviceConfig = rec { ExecStart = ''
${config.hpc.beegfs.package}/bin/beegfs-mgmtd \ cfgFile=${cfgFile} \ pidFile=${PIDFile} \ runDaemonized=false '';
PIDFile = "/run/beegfs-mgmtd.pid"; TimeoutStopSec = "300"; }; }; }))
(mkIf config.hpc.beegfs.meta.enable (let cfgFile = pkgs.writeText "beegfs-meta.conf" ''
storeMetaDirectory = /var/lib/beegs/meta storeAllowFirstRunInit = false sysMgmtdHost = ${config.hpc.beegfs.mgmtdHost} connAuthFile = ${config.hpc.beegfs.connAuthFile} logType = syslog '';
in { systemd.services."beegfs-meta" = { wantedBy = [ "multi-user.target" ]; requires = [ "network-online.target" ]; after = [ "network-online.target" "beegfs-mgmt.service" "beegfs-storage.service" "rdma.service" "opensmd.service" "opensm.service" ];
preStart = ''
if ! test -e /var/lib/beegs/meta; then ${config.hpc.beegfs.package}/bin/beegfs-setup-meta -C -p /var/lib/beegs/meta fi '';
serviceConfig = rec { ExecStart = ''
${config.hpc.beegfs.package}/bin/beegfs-meta \ cfgFile=${cfgFile} \ pidFile=${PIDFile} \ runDaemonized=false '';
PIDFile = "/run/beegfs-meta.pid"; TimeoutStopSec = "300"; }; }; }))
(mkIf config.hpc.beegfs.storage.enable (let cfgFile = pkgs.writeText "beegfs-storage.conf" ''
storeStorageDirectory = /var/lib/beegs/storage storeAllowFirstRunInit = false sysMgmtdHost = ${config.hpc.beegfs.mgmtdHost} connAuthFile = ${config.hpc.beegfs.connAuthFile} logType = syslog '';
in { systemd.services."beegfs-storage" = { wantedBy = [ "multi-user.target" ]; requires = [ "network-online.target" ]; after = [ "network-online.target" "beegfs-mgmt.service" "rdma.service" "opensmd.service" "opensm.service" ];
preStart = ''
if ! test -e /var/lib/beegs/storage; then ${config.hpc.beegfs.package}/bin/beegfs-setup-storage -C -p /var/lib/beegs/storage fi '';
serviceConfig = rec { ExecStart = ''
${config.hpc.beegfs.package}/bin/beegfs-storage \ cfgFile=${cfgFile} \ pidFile=${PIDFile} \ runDaemonized=false '';
PIDFile = "/run/beegfs-storage.pid"; TimeoutStopSec = "300"; }; }; })) ]; }
|