Commit 881ec1ef authored by Thomas Strobel's avatar Thomas Strobel
Browse files

networking module: vswitches: re-structure dependencies to systemd units

parent 7a898019
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -222,21 +222,15 @@ in

        createVswitchDevice = n: v: nameValuePair "${n}-netdev"
          (let
            managedInterfaces = filter (x: hasAttr x cfg.interfaces) v.interfaces;
            managedInterfaceServices = concatMap (i: [ "network-addresses-${i}.service" "network-link-${i}.service" ]) managedInterfaces;
            virtualInterfaces = filter (x: (hasAttr x cfg.interfaces) && cfg.interfaces.${x}.virtual) v.interfaces;
            virtualInterfaceServices = concatMap (i: [ "${i}-netdev.service" ]) virtualInterfaces;
            deps = map subsystemDevice v.interfaces;
            ofRules = pkgs.writeText "vswitch-${n}-openFlowRules" v.openFlowRules;
          in
          { description = "Open vSwitch Interface ${n}";
            wantedBy = [ "network.target" "vswitchd.service" (subsystemDevice n) ];
            requires = optionals v.bindInterfaces (deps ++ managedInterfaceServices ++ virtualInterfaceServices);
            requiredBy = optionals v.bindInterfaces (managedInterfaceServices ++ virtualInterfaceServices);
            bindsTo = deps ++ [ "vswitchd.service" ];
            wantedBy = [ "network.target" "vswitchd.service" ] ++ deps;
            bindsTo =  [ "vswitchd.service" (subsystemDevice n) ] ++ deps;
            partOf = [ "vswitchd.service" ];
            after = [ "network-pre.target" "vswitchd.service" ] ++ deps ++ managedInterfaceServices ++ virtualInterfaceServices;
            before = [ "network-interfaces.target" (subsystemDevice n) ];
            after = [ "network-pre.target" "vswitchd.service" ] ++ deps;
            before = [ "network-interfaces.target" ];
            serviceConfig.Type = "oneshot";
            serviceConfig.RemainAfterExit = true;
            path = [ pkgs.iproute config.virtualisation.vswitch.package ];
+2 −12
Original line number Diff line number Diff line
@@ -398,16 +398,6 @@ in
            "The physical network interfaces connected by the vSwitch.";
        };

        bindInterfaces = mkOption {
          type = types.bool;
          default = false;
          description = ''
            If true, then the interfaces of the vSwitch are brought 'up' and especially
            also 'down' together with the vSwitch. That requires that every interfaces
            is configured as a systemd network services.
          '';
        };

        controllers = mkOption {
          type = types.listOf types.str;
          default = [];