git.iko.soy/typeable/nixpkgs
on master help sign in
networking/bonds: fix examples

After the change of the bonding options, the examples were not quite correct. The diff is over-the top because the new `let` needs everything indented. Also add a small docstring to the `networkd` attr in the networking test.

commit22c265182f9e0d543de0fe46a809180ff2021b85 authorProfpatsch <mail@profpatsch.de> dateMon 6 Mar 2017, 13:23 (10 years ago) parentebeb722
2 files changed+85−82
nixos/modules/tasks/network-interfaces.nix+82−81 nixos/tests/networking.nix+3−1
nixos/modules/tasks/network-interfaces.nix+82−81
@@ -560,101 +560,102 @@ in
560560
561561 };
562562
563− networking.bonds = mkOption {
564− default = { };
565− example = literalExample {
566− bond0 = {
567− interfaces = [ "eth0" "wlan0" ];
568− miimon = 100;
563+ networking.bonds =
564+ let
565+ driverOptionsExample = {
566+ miimon = "100";
569567 mode = "active-backup";
570568 };
571− fatpipe.interfaces = [ "enp4s0f0" "enp4s0f1" "enp5s0f0" "enp5s0f1" ];
572− };
573− description = ''
574− This option allows you to define bond devices that aggregate multiple,
575− underlying networking interfaces together. The value of this option is
576− an attribute set. Each attribute specifies a bond, with the attribute
577− name specifying the name of the bond's network interface
578− '';
569+ in mkOption {
570+ default = { };
571+ example = literalExample {
572+ bond0 = {
573+ interfaces = [ "eth0" "wlan0" ];
574+ driverOptions = driverOptionsExample;
575+ };
576+ anotherBond.interfaces = [ "enp4s0f0" "enp4s0f1" "enp5s0f0" "enp5s0f1" ];
577+ };
578+ description = ''
579+ This option allows you to define bond devices that aggregate multiple,
580+ underlying networking interfaces together. The value of this option is
581+ an attribute set. Each attribute specifies a bond, with the attribute
582+ name specifying the name of the bond's network interface
583+ '';
579584
580− type = with types; attrsOf (submodule {
585+ type = with types; attrsOf (submodule {
581586
582− options = {
587+ options = {
583588
584− interfaces = mkOption {
585− example = [ "enp4s0f0" "enp4s0f1" "wlan0" ];
586− type = types.listOf types.str;
587− description = "The interfaces to bond together";
588− };
589+ interfaces = mkOption {
590+ example = [ "enp4s0f0" "enp4s0f1" "wlan0" ];
591+ type = types.listOf types.str;
592+ description = "The interfaces to bond together";
593+ };
594+
595+ driverOptions = mkOption {
596+ type = types.attrsOf types.str;
597+ default = {};
598+ example = literalExample driverOptionsExample;
599+ description = ''
600+ Options for the bonding driver.
601+ Documentation can be found in
602+ <link xlink:href="https://www.kernel.org/doc/Documentation/networking/bonding.txt" />
603+ '';
589604
590− driverOptions = mkOption {
591− type = types.attrsOf types.str;
592− default = {};
593− example = literalExample {
594− interfaces = [ "eth0" "wlan0" ];
595− miimon = 100;
596− mode = "active-backup";
597605 };
598− description = ''
599− Options for the bonding driver.
600− Documentation can be found in
601− <link xlink:href="https://www.kernel.org/doc/Documentation/networking/bonding.txt" />
602− '';
603606
604− };
607+ lacp_rate = mkOption {
608+ default = null;
609+ example = "fast";
610+ type = types.nullOr types.str;
611+ description = ''
612+ DEPRECATED, use `driverOptions`.
613+ Option specifying the rate in which we'll ask our link partner
614+ to transmit LACPDU packets in 802.3ad mode.
615+ '';
616+ };
605617
606− lacp_rate = mkOption {
607− default = null;
608− example = "fast";
609− type = types.nullOr types.str;
610− description = ''
611− DEPRECATED, use `driverOptions`.
612− Option specifying the rate in which we'll ask our link partner
613− to transmit LACPDU packets in 802.3ad mode.
614− '';
615− };
618+ miimon = mkOption {
619+ default = null;
620+ example = 100;
621+ type = types.nullOr types.int;
622+ description = ''
623+ DEPRECATED, use `driverOptions`.
624+ Miimon is the number of millisecond in between each round of polling
625+ by the device driver for failed links. By default polling is not
626+ enabled and the driver is trusted to properly detect and handle
627+ failure scenarios.
628+ '';
629+ };
616630
617− miimon = mkOption {
618− default = null;
619− example = 100;
620− type = types.nullOr types.int;
621− description = ''
622− DEPRECATED, use `driverOptions`.
623− Miimon is the number of millisecond in between each round of polling
624− by the device driver for failed links. By default polling is not
625− enabled and the driver is trusted to properly detect and handle
626− failure scenarios.
627− '';
628− };
631+ mode = mkOption {
632+ default = null;
633+ example = "active-backup";
634+ type = types.nullOr types.str;
635+ description = ''
636+ DEPRECATED, use `driverOptions`.
637+ The mode which the bond will be running. The default mode for
638+ the bonding driver is balance-rr, optimizing for throughput.
639+ More information about valid modes can be found at
640+ https://www.kernel.org/doc/Documentation/networking/bonding.txt
641+ '';
642+ };
629643
630− mode = mkOption {
631− default = null;
632− example = "active-backup";
633− type = types.nullOr types.str;
634− description = ''
635− DEPRECATED, use `driverOptions`.
636− The mode which the bond will be running. The default mode for
637− the bonding driver is balance-rr, optimizing for throughput.
638− More information about valid modes can be found at
639− https://www.kernel.org/doc/Documentation/networking/bonding.txt
640− '';
641− };
644+ xmit_hash_policy = mkOption {
645+ default = null;
646+ example = "layer2+3";
647+ type = types.nullOr types.str;
648+ description = ''
649+ DEPRECATED, use `driverOptions`.
650+ Selects the transmit hash policy to use for slave selection in
651+ balance-xor, 802.3ad, and tlb modes.
652+ '';
653+ };
642654
643− xmit_hash_policy = mkOption {
644− default = null;
645− example = "layer2+3";
646− type = types.nullOr types.str;
647− description = ''
648− DEPRECATED, use `driverOptions`.
649− Selects the transmit hash policy to use for slave selection in
650− balance-xor, 802.3ad, and tlb modes.
651− '';
652655 };
653656
654− };
655−
656− });
657− };
657+ });
658+ };
658659
659660 networking.macvlans = mkOption {
660661 default = { };
nixos/tests/networking.nix+3−1
@@ -1,4 +1,6 @@
1−{ system ? builtins.currentSystem, networkd }:
1+{ system ? builtins.currentSystem
2+# bool: whether to use networkd in the tests
3+, networkd }:
24
35with import ../lib/testing.nix { inherit system; };
46with pkgs.lib;