Correct contianer network creation and test it

The container network creation process needs to assume that the bridge
name is available and fall back to the interface. Previously this was
being done in reverse.

Change-Id: I51829349b5bc3f97c100a379b13f7e99f4007228
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-05-15 12:56:31 -05:00
parent 10146fdf2b
commit f3421d7687
No known key found for this signature in database
GPG Key ID: 9443251A787B9FB3
3 changed files with 20 additions and 7 deletions

View File

@ -298,7 +298,11 @@
systemd_networks: |-
{% set _networks = [] %}
{% for _, value in (container_networks | combine(nspawn_networks)).items() %}
{% set _network = {'interface': value.interface | default('mv-mv-' + value.bridge.split('br-')[-1])} %}
{% if value.bridge is defined %}
{% set _network = {'interface': 'mv-mv-' + value.bridge.split('br-')[-1]} %}
{% else %}
{% set _network = {'interface': value.interface} %}
{% endif %}
{% if value.address is defined %}
{% set _ = _network.__setitem__('address', value.address) %}
{% if (value.netmask is defined) and (_network.address != 'dhcp') %}

View File

@ -22,8 +22,6 @@
{% for key, value in container_networks.items() %}
{% if value.bridge is defined %}
{% set macvlan = 'mv-' + value.bridge.split('br-')[-1] %}
{% else %}
{% set macvlan = 'mv-' + key %}
{% endif %}
{% if macvlan not in macvlans %}
{% set _ = macvlans.append(macvlan) %}

View File

@ -18,14 +18,25 @@
connection: local
become: true
tasks:
# NOTE(cloudnull): This should be revised at a future date.
- name: Test intra cluster connectivity
command: ping -c 1 8.8.8.8
- name: Test connectivity to external address
command: ping -c 1 git.openstack.org
register: machinectl_ping
retries: 3
delay: 2
until: machinectl_ping is success
failed_when: false
delegate_to: "{{ item }}"
with_items: "{{ groups['all_containers'] }}"
tags:
- skip_ansible_lint
- name: Test connectivity to internal address
command: ping -c 1 172.29.100.101
register: machinectl_ping
retries: 3
delay: 2
until: machinectl_ping is success
delegate_to: "{{ item }}"
with_items: "{{ groups['all_containers'] }}"
tags:
- skip_ansible_lint