From 17fc2d9b475da15a571fe6ed1aa51fadc3b076cc Mon Sep 17 00:00:00 2001 From: Daneyon Hansen Date: Tue, 21 Apr 2015 07:37:32 +0000 Subject: [PATCH] Removes existing network namespaces for neutron-agents container Previously, network namespaces would not work correctly when restarting or stop/rm/start the neutron-agents container. This is because network namespaces created within the container are associated to the container's pid: /pid/$CONTAINER_PID/ns/net. With this patch, when a container starts or restarts, the l3/dhcp agent start scripts will remove any existing qrouter/qdhcp network namespaces before starting the agents. The agents will recreate the necessary network namespaces since they are stored in the db. Closes-Bug: 1444219 Change-Id: Ia86729766fe8c2fc145b3a02d519746b149a73bb --- .../neutron-agents/config-scripts/config-dhcp-agent.sh | 5 +++++ .../neutron/neutron-agents/config-scripts/config-l3-agent.sh | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/docker/neutron/neutron-agents/config-scripts/config-dhcp-agent.sh b/docker/neutron/neutron-agents/config-scripts/config-dhcp-agent.sh index 08d2b21b1a..f9f0d3bceb 100755 --- a/docker/neutron/neutron-agents/config-scripts/config-dhcp-agent.sh +++ b/docker/neutron/neutron-agents/config-scripts/config-dhcp-agent.sh @@ -77,5 +77,10 @@ dhcp-option-force=26,1450 log-facility=${NEUTRON_LOG_DIR}/neutron-dnsmasq.log EOF +# Remove any existing qdhcp namespaces +ip netns list | grep qdhcp | while read -r line ; do + ip netns delete $line +done + # Start DHCP Agent exec /usr/bin/neutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.ini diff --git a/docker/neutron/neutron-agents/config-scripts/config-l3-agent.sh b/docker/neutron/neutron-agents/config-scripts/config-l3-agent.sh index 5f88869d21..bc9692c04f 100755 --- a/docker/neutron/neutron-agents/config-scripts/config-l3-agent.sh +++ b/docker/neutron/neutron-agents/config-scripts/config-l3-agent.sh @@ -76,5 +76,10 @@ elif [ "${USE_NAMESPACES}" == "true" ] ; then "true" fi +# Remove any existing qrouter namespaces +ip netns list | grep qrouter | while read -r line ; do + ip netns delete $line +done + # Start L3 Agent exec /usr/bin/neutron-l3-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/l3_agent.ini --config-file /etc/neutron/fwaas_driver.ini