From 251a00da4cb5073b9e38f40348835a194a68e6ca Mon Sep 17 00:00:00 2001 From: Thomas Strobel Date: Thu, 24 Sep 2015 12:44:07 +0200 Subject: [PATCH] openvswitch module: add option to reset db on start --- nixos/modules/virtualisation/openvswitch.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nixos/modules/virtualisation/openvswitch.nix b/nixos/modules/virtualisation/openvswitch.nix index 1c77945a6cb5..4d6123e4ce51 100644 --- a/nixos/modules/virtualisation/openvswitch.nix +++ b/nixos/modules/virtualisation/openvswitch.nix @@ -19,6 +19,15 @@ in { ''; }; + resetOnStart = mkOption { + type = types.bool; + default = false; + description = '' + Whether to reset the Open vSwitch configuration database to a default + configuration on every start of the systemd ovsdb.service. + ''; + }; + package = mkOption { type = types.package; default = pkgs.openvswitch; @@ -75,6 +84,7 @@ in { mkdir -p ${runDir} mkdir -p /var/db/openvswitch chmod +w /var/db/openvswitch + ${optionalString cfg.resetOnStart "rm -f /var/db/openvswitch/conf.db"} if [[ ! -e /var/db/openvswitch/conf.db ]]; then ${cfg.package}/bin/ovsdb-tool create \ "/var/db/openvswitch/conf.db" \