diff options
| author | Sam Yaple <sam@yaple.net> | 2015-09-27 12:37:23 +0000 |
|---|---|---|
| committer | Sam Yaple <sam@yaple.net> | 2015-09-27 13:44:50 +0000 |
| commit | 94ea43fa555fac20c15cdb4f4214af20913b6270 (patch) | |
| tree | 2beffb5a81dfaf991020db5e900fba47ca566eed | |
| parent | 7ef0b8966cf7cce1d5de031f58e826e85209d980 (diff) | |
| download | kolla-94ea43fa555fac20c15cdb4f4214af20913b6270.tar.gz kolla-94ea43fa555fac20c15cdb4f4214af20913b6270.zip | |
Replace config-external - openvswitch
Change-Id: Ib05442c6ee146d2deb49fc235ba16fc7e0c3d6c8
Partially-Implements: blueprint replace-config-external
| -rw-r--r-- | ansible/roles/neutron/tasks/config.yml | 30 | ||||
| -rw-r--r-- | ansible/roles/neutron/tasks/start.yml | 2 | ||||
| -rw-r--r-- | ansible/roles/neutron/templates/openvswitch-db-server.json.j2 | 4 | ||||
| -rw-r--r-- | ansible/roles/neutron/templates/openvswitch-vswitchd.json.j2 | 4 | ||||
| -rwxr-xr-x | docker/openvswitch/ovs-db-server/start.sh | 22 | ||||
| -rwxr-xr-x | docker/openvswitch/ovs-vswitchd/start.sh | 15 |
6 files changed, 48 insertions, 29 deletions
diff --git a/ansible/roles/neutron/tasks/config.yml b/ansible/roles/neutron/tasks/config.yml index 8d138b11c..f7b5df470 100644 --- a/ansible/roles/neutron/tasks/config.yml +++ b/ansible/roles/neutron/tasks/config.yml @@ -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" diff --git a/ansible/roles/neutron/tasks/start.yml b/ansible/roles/neutron/tasks/start.yml index d028fd2c0..7922aee05 100644 --- a/ansible/roles/neutron/tasks/start.yml +++ b/ansible/roles/neutron/tasks/start.yml @@ -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']) diff --git a/ansible/roles/neutron/templates/openvswitch-db-server.json.j2 b/ansible/roles/neutron/templates/openvswitch-db-server.json.j2 new file mode 100644 index 000000000..ed1773ea2 --- /dev/null +++ b/ansible/roles/neutron/templates/openvswitch-db-server.json.j2 @@ -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": [] +} diff --git a/ansible/roles/neutron/templates/openvswitch-vswitchd.json.j2 b/ansible/roles/neutron/templates/openvswitch-vswitchd.json.j2 new file mode 100644 index 000000000..b0d8d0712 --- /dev/null +++ b/ansible/roles/neutron/templates/openvswitch-vswitchd.json.j2 @@ -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": [] +} diff --git a/docker/openvswitch/ovs-db-server/start.sh b/docker/openvswitch/ovs-db-server/start.sh index 89b2e3e92..4d3d772cc 100755 --- a/docker/openvswitch/ovs-db-server/start.sh +++ b/docker/openvswitch/ovs-db-server/start.sh @@ -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 - -mkdir -p "${UNIXSOCK_DIR}" +python /opt/kolla/set_configs.py +CMD=$(cat /run_command) -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 diff --git a/docker/openvswitch/ovs-vswitchd/start.sh b/docker/openvswitch/ovs-vswitchd/start.sh index 3ec2c26b2..792954bb4 100755 --- a/docker/openvswitch/ovs-vswitchd/start.sh +++ b/docker/openvswitch/ovs-vswitchd/start.sh @@ -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 |
