mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 04:43:09 +03:00
* Add a module for DRBD.
svn path=/nixos/trunk/; revision=30202
This commit is contained in:
parent
0309f02fc5
commit
aac71e8f95
@ -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
|
||||
|
77
modules/services/network-filesystems/drbd.nix
Normal file
77
modules/services/network-filesystems/drbd.nix
Normal file
@ -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…
Reference in New Issue
Block a user