Adds the appropriate tools to addin the ovs bridge

Ansible will exec a script in the OVS container to ensure the bridge and
ports are properly setup. The script is idempotent.

Change-Id: I5adca595a4d2ef4edf26c9635cfa5ceb30ca4a59
Closes-Bug: #1466375
This commit is contained in:
Sam Yaple 2015-07-23 11:25:42 +00:00
parent 6d4a55060e
commit 77f71b9f59
7 changed files with 30 additions and 5 deletions

View File

@ -59,3 +59,5 @@ neutron_logging_verbose: "{{ openstack_logging_verbose }}"
neutron_logging_debug: "{{ openstack_logging_debug }}"
neutron_keystone_user: "neutron"
neutron_bridge_name: "br-ex"

View File

@ -23,6 +23,11 @@
when: inventory_hostname in groups['compute'] or
inventory_hostname in groups['neutron-agents']
- name: Ensuring OVS bridge is properly setup
command: docker exec openvswitch_vswitchd /opt/kolla/ovs_ensure_configured.sh {{ neutron_bridge_name }} {{ neutron_interface }}
register: status
changed_when: status.stdout.find('changed') != -1
- include: ../../start.yml
vars:
container_environment:

View File

@ -31,5 +31,5 @@ arp_responder = true
#enable_distributed_routing = true
[ovs]
local_ip = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}
bridge_mappings = external:{{ neutron_interface }}
local_ip = {{ hostvars[inventory_hostname]['ansible_' + tunnel_interface]['ipv4']['address'] }}
bridge_mappings = external:{{ neutron_bridge_name }}

View File

@ -3,6 +3,6 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
COPY ./start.sh /start.sh
COPY config-internal.sh config-external.sh /opt/kolla/
COPY ovs_ensure_configured.sh config-internal.sh config-external.sh /opt/kolla/
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../common/openvswitch/ovs-vswitchd/ovs_ensure_configured.sh

View File

@ -0,0 +1,17 @@
#!/bin/bash
bridge=$1
port=$2
ovs-vsctl br-exists $bridge; rc=$?
if [[ $rc == 2 ]]; then
changed=changed
ovs-vsctl add-br $bridge
fi
if [[ ! $(ovs-vsctl list-ports $bridge) =~ $(echo "\<$port\>") ]]; then
changed=changed
ovs-vsctl add-port $bridge $port
fi
echo $changed

View File

@ -54,12 +54,12 @@ docker_restart_policy_retry: "10"
####################
# The interface to use for various services types
network_interface: "eth0"
neutron_interface: "eth1"
# These can be adjusted for even more customization
api_interface: "{{ network_interface }}"
storage_interface: "{{ network_interface }}"
neutron_interface: "{{ network_interface }}"
tunnel_interface: "{{ network_interface }}"
####################
# Openstack options