* Add a module for DRBD.

svn path=/nixos/trunk/; revision=30202
wip/yesman
Eelco Dolstra 13 years ago
parent 0309f02fc5
commit aac71e8f95
  1. 1
      modules/module-list.nix
  2. 77
      modules/services/network-filesystems/drbd.nix
  3. 2
      modules/system/activation/switch-to-configuration.sh

@ -96,6 +96,7 @@
./services/monitoring/systemhealth.nix
./services/monitoring/zabbix-agent.nix
./services/monitoring/zabbix-server.nix
./services/network-filesystems/drbd.nix
./services/network-filesystems/nfs-kernel.nix
./services/network-filesystems/openafs-client/default.nix
./services/network-filesystems/samba.nix

@ -0,0 +1,77 @@
# Support for DRBD, the Distributed Replicated Block Device.
{ config, pkgs, ... }:
with pkgs.lib;
let cfg = config.services.drbd; in
{
###### interface
options = {
services.drbd.enable = mkOption {
default = false;
type = types.bool;
description = ''
Whether to enable support for DRBD, the Distributed Replicated
Block Device.
'';
};
services.drbd.config = mkOption {
default = "";
type = types.string;
description = ''
Contents of the <filename>drbd.conf</filename> configuration file.
'';
};
};
###### implementation
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.drbd ];
services.udev.packages = [ pkgs.drbd ];
boot.kernelModules = [ "drbd" ];
boot.extraModprobeConfig =
''
options drbd usermode_helper=/var/run/current-system/sw/sbin/drbdadm
'';
environment.etc = singleton
{ source = pkgs.writeText "drbd.conf" cfg.config;
target = "drbd.conf";
};
jobs.drbd_up =
{ name = "drbd-up";
startOn = "stopped udevtrigger or ip-up";
task = true;
script =
''
${pkgs.drbd}/sbin/drbdadm up all
'';
};
jobs.drbd_down =
{ name = "drbd-down";
startOn = "starting shutdown";
task = true;
script =
''
${pkgs.drbd}/sbin/drbdadm down all
'';
};
};
}

@ -114,7 +114,7 @@ EOF
# Xen domains unless we have to.
# TODO: Jobs should be able to declare that they should not be
# auto-restarted.
if echo "$job" | grep -q "^shutdown$\|^control-alt-delete$\|^xserver$\|^dbus$\|^disnix$\|^emergency-shell$\|^xendomains$\|^udevtrigger$"; then continue; fi
if echo "$job" | grep -q "^shutdown$\|^control-alt-delete$\|^xserver$\|^dbus$\|^disnix$\|^emergency-shell$\|^xendomains$\|^udevtrigger$\|^drbd-down$"; then continue; fi
if ! test -e "$oldJobs/$job.conf"; then
echo "starting $job..."

Loading…
Cancel
Save