mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
openvswitch module: add option to reset db on start
This commit is contained in:
parent
9cc7859b2e
commit
251a00da4c
1 changed files with 10 additions and 0 deletions
|
@ -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 <literal>ovsdb.service</literal>.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = pkgs.openvswitch;
|
default = pkgs.openvswitch;
|
||||||
|
@ -75,6 +84,7 @@ in {
|
||||||
mkdir -p ${runDir}
|
mkdir -p ${runDir}
|
||||||
mkdir -p /var/db/openvswitch
|
mkdir -p /var/db/openvswitch
|
||||||
chmod +w /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
|
if [[ ! -e /var/db/openvswitch/conf.db ]]; then
|
||||||
${cfg.package}/bin/ovsdb-tool create \
|
${cfg.package}/bin/ovsdb-tool create \
|
||||||
"/var/db/openvswitch/conf.db" \
|
"/var/db/openvswitch/conf.db" \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue