From 12ef8149d58d1fcb4426b65fdf09c283f3345e5c Mon Sep 17 00:00:00 2001 From: Rabi Mishra Date: Tue, 15 Jan 2019 16:13:33 +0530 Subject: [PATCH] Create /run/netns if does not exist Unlike docker with podman you can't mount a host directory that does not exist. We did some work as part of bug 1799638 take care of this for reboots. However, we need it to be created for fresh installations, as nodes are not necessarily rebooted after installing paunch. The real issue without reboots did not surface before the next patch in this series, as we were using cni0 bridge network for some containers and that resulted in namespace being created and the directory existing for neutron_dhcp and neutron_l3 containers in step 4 to mount them. This patch creates/removes a temp namespace in host_prep_tasks to ensure that the directory exists. Change-Id: I19d660168c98887a5e352b3413235888c800760d Related-Bug: #1799638 (cherry picked from commit 9b284e74cbdcf43253edaf424534b71a483fdb69) --- docker/services/neutron-dhcp.yaml | 8 ++++++++ docker/services/neutron-l3.yaml | 8 ++++++++ docker/services/ovn-metadata.yaml | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/docker/services/neutron-dhcp.yaml b/docker/services/neutron-dhcp.yaml index 18434db840..8d672522e2 100644 --- a/docker/services/neutron-dhcp.yaml +++ b/docker/services/neutron-dhcp.yaml @@ -236,6 +236,14 @@ outputs: host_prep_tasks: list_concat: - {get_attr: [NeutronLogging, host_prep_tasks]} + - - name: create /run/netns with temp namespace + command: ip netns add ns_temp + register: ipnetns_add_result + ignore_errors: True + - - name: remove temp namespace + command: ip netns delete ns_temp + ignore_errors: True + when: ipnetns_add_result.rc == 0 - - name: create /var/lib/neutron file: path: /var/lib/neutron diff --git a/docker/services/neutron-l3.yaml b/docker/services/neutron-l3.yaml index d1cc0ec93d..10947efe34 100644 --- a/docker/services/neutron-l3.yaml +++ b/docker/services/neutron-l3.yaml @@ -232,6 +232,14 @@ outputs: host_prep_tasks: list_concat: - {get_attr: [NeutronLogging, host_prep_tasks]} + - - name: create /run/netns with temp namespace + command: ip netns add ns_temp + register: ipnetns_add_result + ignore_errors: True + - - name: remove temp namespace + command: ip netns delete ns_temp + ignore_errors: True + when: ipnetns_add_result.rc == 0 - - name: create /var/lib/neutron file: path: /var/lib/neutron diff --git a/docker/services/ovn-metadata.yaml b/docker/services/ovn-metadata.yaml index c5ca64c9db..9d22851299 100644 --- a/docker/services/ovn-metadata.yaml +++ b/docker/services/ovn-metadata.yaml @@ -186,6 +186,14 @@ outputs: host_prep_tasks: list_concat: - {get_attr: [NeutronLogging, host_prep_tasks]} + - - name: create /run/netns with temp namespace + command: ip netns add ns_temp + register: ipnetns_add_result + ignore_errors: True + - - name: remove temp namespace + command: ip netns delete ns_temp + ignore_errors: True + when: ipnetns_add_result.rc == 0 - - name: create /var/lib/neutron file: path: /var/lib/neutron