瀏覽代碼

Merge "Adding ability to configure OVS logging"

pull/143/merge
mcp-jenkins 6 年之前
父節點
當前提交
ea41be1a01
共有 3 個文件被更改,包括 73 次插入0 次删除
  1. +44
    -0
      linux/files/openvswitch-switch.default
  2. +3
    -0
      linux/network/init.sls
  3. +26
    -0
      linux/network/openvswitch.sls

+ 44
- 0
linux/files/openvswitch-switch.default 查看文件

@@ -0,0 +1,44 @@
{%- from "linux/map.jinja" import network with context %}
{%- set openvswitch = network.openvswitch %}
# This is a POSIX shell fragment -*- sh -*-

# FORCE_COREFILES: If 'yes' then core files will be enabled.
# FORCE_COREFILES=yes

# OVS_CTL_OPTS: Extra options to pass to ovs-ctl. This is, for example,
# a suitable place to specify --ovs-vswitchd-wrapper=valgrind.
# OVS_CTL_OPTS=

# OVS_VSWITCHD_OPTS: Extra options to pass to ovs-ctl.
# Options to start Open vSwitch daemon with.
# Example: '-vconsole:dbg -vsyslog:dbg -vfile:dbg -vFACILITY:clock2'
# OVS_VSWITCHD_OPTS=
{%- if openvswitch.get('logging', {}).vswitchd is defined %}
{%- set _vswitchd_opts = [] %}
{%- for opt in ['console', 'file', 'syslog'] %}
{%- if openvswitch.logging.vswitchd.get(opt) %}
{%- do _vswitchd_opts.append("-v"+ opt + ":" + openvswitch.logging.vswitchd.get(opt)) %}
{%- endif %}
{%- endfor %}
{%- if openvswitch.logging.vswitchd.facility is defined %}
{%- do _vswitchd_opts.append("-vFACILITY:" + openvswitch.logging.vswitchd.facility) %}
{%- endif %}
OVS_VSWITCHD_OPTS="{{ ' '.join(_vswitchd_opts) }}"
{%- endif %}

# OVSDB_OPTS: Extra options to pass to ovs-ctl.
# Options to start Open vSwitch DB daemon with.
# Example: '-vconsole:dbg -vsyslog:dbg -vfile:dbg -vFACILITY:clock2'
# OVSDB_OPTS=
{%- if openvswitch.get('logging', {}).ovsdb is defined %}
{%- set _ovsdb_opts = [] %}
{%- for opt in ['console', 'file', 'syslog'] %}
{%- if openvswitch.logging.ovsdb.get(opt) %}
{%- do _ovsdb_opts.append("-v" + opt + ":" + openvswitch.logging.ovsdb.get(opt)) %}
{%- endif %}
{%- endfor %}
{%- if openvswitch.logging.ovsdb.facility is defined %}
{%- do _ovsdb_opts.append("-vFACILITY:" + openvswitch.logging.ovsdb.facility) %}
{%- endif %}
OVSDB_OPTS="{{ ' '.join(_ovsdb_opts) }}"
{%- endif %}

+ 3
- 0
linux/network/init.sls 查看文件

@@ -16,6 +16,9 @@ include:
{%- if network.systemd|length > 0 %}
- linux.network.systemd
{%- endif %}
{%- if network.openvswitch is defined %}
- linux.network.openvswitch
{%- endif %}
{%- if network.interface|length > 0 %}
- linux.network.interface
{%- endif %}

+ 26
- 0
linux/network/openvswitch.sls 查看文件

@@ -0,0 +1,26 @@
{%- from "linux/map.jinja" import network with context %}

{%- if network.get('openvswitch', {}).get('enabled', False) %}

openvswitch_pkgs:
pkg.installed:
- pkgs: {{ network.ovs_pkgs }}

/etc/default/openvswitch-switch:
file.managed:
- source: salt://linux/files/openvswitch-switch.default
- template: jinja
- require:
- pkg: openvswitch_pkgs

openvswitch_switch_service:
service.running:
- name: openvswitch-switch
- enable: true
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
- watch:
- file: /etc/default/openvswitch-switch

{%- endif %}

Loading…
取消
儲存