Correct networking setup for macvlan

The macvlan setup was duplicating IP addresses from the host using the mv
interface. This caused all kinds of unexpected brokeness. This change
corrects the config so that the role is not longer overreaching.

The test setup to pin the image download url elsewhere has been removed
as it's now causing problems connecting to the index.

Change-Id: Ida9751f6ad94bf5e4b0dcd15a506e503350fdd9d
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-06-22 17:04:19 -05:00
parent d681a15af5
commit 455c372b06
No known key found for this signature in database
GPG Key ID: 9443251A787B9FB3
2 changed files with 5 additions and 13 deletions

View File

@ -94,6 +94,7 @@
{%- else %}
{%- set _ = start_commands.append('-/sbin/ip link add ' + mv_interface + ' link ' + value.bridge + ' type macvlan mode ' + value.macvlan_mode | default(nspawn_macvlan_mode)) %}
{%- endif %}
{%- set _ = start_commands.append('-/sbin/ip link set dev ' + mv_interface + ' up') %}
{%- set _ = seen_start_interfaces.append(value.bridge) %}
{%- endif %}
{%- endfor %}
@ -114,7 +115,7 @@
systemd_netdevs: |-
{% set seen_netdevs = [] %}
{% set _netdevs = [] %}
{% for _, value in nspawn_combined_networks.items() %}
{% for _, value in (nspawn_networks | combine(container_extra_networks | default({}))).items() %}
{% set netname = value.interface | default('mv-' + value.bridge.split('br-')[-1]) %}
{% set _netdev = {'NetDev': {'Name': netname, 'Kind': 'macvlan'}, 'MACVLAN': {'Mode': 'bridge'}} %}
{% if netname not in seen_netdevs %}
@ -126,7 +127,9 @@
systemd_networks: |-
{% set seen_networks = [] %}
{% set _networks = [] %}
{% for _, value in nspawn_combined_networks.items() %}
{# All nspawn_networks and container_extra_networks will be iterated over. #}
{# If a device is found, a networkd config will be generated for it. #}
{% for _, value in (nspawn_networks | combine(container_extra_networks | default({}))).items() %}
{% set netname = value.interface | default('mv-' + value.bridge.split('br-')[-1]) %}
{% set _network = {'interface': netname} %}
{% if netname not in seen_networks %}

View File

@ -56,17 +56,6 @@
set_fact:
nspawn_container_ssh_key: "{{ _root_ssh_key['content'] | b64decode }}"
# This is a very dirty hack due to images.linuxcontainers.org
# constantly failing to resolve in openstack-infra.
- name: Implement hard-coded hosts entries for consistently failing name
lineinfile:
path: "/etc/hosts"
line: "{{ item }}"
state: present
with_items:
- "91.189.91.21 images.linuxcontainers.org us.images.linuxcontainers.org"
- "91.189.88.37 images.linuxcontainers.org uk.images.linuxcontainers.org"
roles:
- role: "nspawn_hosts"
nspawn_container_base_name: "test-container"