Replace config-external - openvswitch

Change-Id: Ib05442c6ee146d2deb49fc235ba16fc7e0c3d6c8
Partially-Implements: blueprint replace-config-external
This commit is contained in:
Sam Yaple 2015-09-27 12:37:23 +00:00
parent 7ef0b8966c
commit 94ea43fa55
6 changed files with 48 additions and 29 deletions

View File

@ -147,10 +147,36 @@
template:
src: "roles/neutron/templates/neutron-openvswitch-agent.json.j2"
dest: "{{ node_config_directory }}/neutron-openvswitch-agent/config.json"
when: neutron_plugin_agent == "openvswitch"
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
and neutron_plugin_agent == "openvswitch"
- name: Ensuring config directories exists
file:
path: "{{ node_config_directory }}/{{ item }}"
state: "directory"
with_items:
- "openvswitch-db-server"
- "openvswitch-vswitchd"
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
and neutron_plugin_agent == "openvswitch"
- name: Copying openvswitch-db-server JSON configuration file
template:
src: "openvswitch-db-server.json.j2"
dest: "{{ node_config_directory }}/openvswitch-db-server/config.json"
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
and neutron_plugin_agent == "openvswitch"
- name: Copying openvswitch-vswitchd JSON configuration file
template:
src: "openvswitch-vswitchd.json.j2"
dest: "{{ node_config_directory }}/openvswitch-vswitchd/config.json"
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
and neutron_plugin_agent == "openvswitch"
- name: Copying Neutron Linuxbridge JSON configuration file
template:
src: "roles/neutron/templates/neutron-server.json.j2"
dest: "{{ node_config_directory }}/neutron-linuxbridge-agent/config.json"
when: neutron_plugin_agent == "linuxbridge"
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
and neutron_plugin_agent == "linuxbridge"

View File

@ -15,6 +15,7 @@
image: "{{ openvswitch_db_image_full }}"
volumes:
- "/run:/run"
- "{{ node_config_directory }}/openvswitch-db-server/:/opt/kolla/config_files/:ro"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
@ -38,6 +39,7 @@
volumes:
- "/run:/run"
- "/lib/modules:/lib/modules:ro"
- "{{ node_config_directory }}/openvswitch-vswitchd/:/opt/kolla/config_files/:ro"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])

View File

@ -0,0 +1,4 @@
{
"command": "/usr/sbin/ovsdb-server /etc/openvswitch/conf.db -vconsole:emer -vsyslog:err -vfile:info --remote=punix:/run/openvswitch/db.sock --log-file=/var/log/openvswitch/ovsdb-server.log",
"config_files": []
}

View File

@ -0,0 +1,4 @@
{
"command": "/usr/sbin/ovs-vswitchd unix:/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --log-file=/var/log/openvswitch/ovs-vswitchd.log",
"config_files": []
}

View File

@ -1,25 +1,15 @@
#!/bin/bash
set -o errexit
LOG_FILE="/var/log/openvswitch/ovsdb-server.log"
DB_FILE="/etc/openvswitch/conf.db"
UNIXSOCK_DIR="/var/run/openvswitch"
UNIXSOCK="${UNIXSOCK_DIR}/db.sock"
CMD="/usr/sbin/ovsdb-server"
ARGS="$DB_FILE -vconsole:emer -vsyslog:err -vfile:info --remote=punix:${UNIXSOCK} --log-file=${LOG_FILE}"
# Loading common functions.
source /opt/kolla/kolla-common.sh
# Execute config strategy
set_configs
python /opt/kolla/set_configs.py
CMD=$(cat /run_command)
mkdir -p "${UNIXSOCK_DIR}"
if [[ ! -e "${DB_FILE}" ]]; then
ovsdb-tool create "${DB_FILE}"
mkdir -p "/run/openvswitch"
if [[ ! -e "/etc/openvswitch/conf.db" ]]; then
ovsdb-tool create "/etc/openvswitch/conf.db"
fi
exec $CMD $ARGS
exec $CMD

View File

@ -1,19 +1,12 @@
#!/bin/bash
LOG_FILE="/var/log/openvswitch/ovs-vswitchd.log"
DB_FILE="/etc/openvswitch/conf.db"
UNIXSOCK_DIR="/var/run/openvswitch"
UNIXSOCK="${UNIXSOCK_DIR}/db.sock"
CMD="/usr/sbin/ovs-vswitchd"
ARGS="unix:${UNIXSOCK} -vconsole:emer -vsyslog:err -vfile:info --mlockall --log-file=${LOG_FILE}"
set -o errexit
# Loading common functions.
source /opt/kolla/kolla-common.sh
# Execute config strategy
set_configs
python /opt/kolla/set_configs.py
CMD=$(cat /run_command)
modprobe openvswitch
mkdir -p "${UNIXSOCK_DIR}"
exec $CMD $ARGS
exec $CMD