From 62e02fdbf4a4f714d008943c4e5c8512a93807ed Mon Sep 17 00:00:00 2001 From: Sam Yaple Date: Sat, 27 Jun 2015 12:07:46 +0000 Subject: [PATCH] Partially revert thin neutron containers Due to a revert in the Docker code, thin neutron containers do not work at this time. The neutron plugin agents do not need to exist in the same container as the other agents however. This allows for using either linuxbridge or openvswitch The docker commit that did the revert: https://github.com/docker/docker/commit/ff770d33cdee5ab4dc0bdeb06dcfea49aa72ab8e Closes-Bug: 1469307 Change-Id: Idf79c31c74c34b93f5a9bac49730aca49bbdb861 --- compose/neutron-agents.yml | 11 +++++ compose/neutron-dhcp-agent.yml | 12 ----- compose/neutron-l3-agent.yml | 12 ----- compose/neutron-linuxbridge-agent.yml | 1 - compose/neutron-metadata-agent.yml | 12 ----- .../Dockerfile | 17 ++++++- .../build | 0 .../fwaas_driver.ini | 0 .../neutron-dhcp-agent/check.sh | 1 + .../neutron-dhcp-agent/start.sh | 1 + .../neutron-agents/neutron-l3-agent/check.sh | 1 + .../neutron-l3-agent/fwaas_driver.ini | 1 + .../neutron-agents/neutron-l3-agent/start.sh | 1 + .../neutron-metadata-agent/check.sh | 1 + .../neutron-metadata-agent/start.sh | 1 + .../neutron/neutron-agents/supervisord.conf | 46 +++++++++++++++++++ .../binary/neutron/neutron-base/Dockerfile | 8 ---- .../neutron/neutron-dhcp-agent/Dockerfile | 6 --- .../neutron/neutron-dhcp-agent/check.sh | 1 - .../neutron/neutron-dhcp-agent/start.sh | 1 - .../binary/neutron/neutron-l3-agent/build | 1 - .../binary/neutron/neutron-l3-agent/check.sh | 1 - .../binary/neutron/neutron-l3-agent/start.sh | 1 - .../neutron/neutron-metadata-agent/Dockerfile | 6 --- .../neutron/neutron-metadata-agent/build | 1 - .../neutron/neutron-metadata-agent/check.sh | 1 - .../neutron/neutron-metadata-agent/start.sh | 1 - .../neutron/neutron-dhcp-agent/start.sh | 11 +++++ .../common/neutron/neutron-l3-agent/start.sh | 11 +++++ tools/kolla | 4 +- 30 files changed, 102 insertions(+), 70 deletions(-) create mode 100644 compose/neutron-agents.yml delete mode 100644 compose/neutron-dhcp-agent.yml delete mode 100644 compose/neutron-l3-agent.yml delete mode 100644 compose/neutron-metadata-agent.yml rename docker/centos/binary/neutron/{neutron-l3-agent => neutron-agents}/Dockerfile (58%) rename docker/centos/binary/neutron/{neutron-dhcp-agent => neutron-agents}/build (100%) rename docker/centos/binary/neutron/{neutron-l3-agent => neutron-agents}/fwaas_driver.ini (100%) create mode 120000 docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/check.sh create mode 120000 docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/start.sh create mode 120000 docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/check.sh create mode 120000 docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/fwaas_driver.ini create mode 120000 docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/start.sh create mode 120000 docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/check.sh create mode 120000 docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/start.sh create mode 100644 docker/centos/binary/neutron/neutron-agents/supervisord.conf delete mode 100644 docker/centos/binary/neutron/neutron-dhcp-agent/Dockerfile delete mode 120000 docker/centos/binary/neutron/neutron-dhcp-agent/check.sh delete mode 120000 docker/centos/binary/neutron/neutron-dhcp-agent/start.sh delete mode 120000 docker/centos/binary/neutron/neutron-l3-agent/build delete mode 120000 docker/centos/binary/neutron/neutron-l3-agent/check.sh delete mode 120000 docker/centos/binary/neutron/neutron-l3-agent/start.sh delete mode 100644 docker/centos/binary/neutron/neutron-metadata-agent/Dockerfile delete mode 120000 docker/centos/binary/neutron/neutron-metadata-agent/build delete mode 120000 docker/centos/binary/neutron/neutron-metadata-agent/check.sh delete mode 120000 docker/centos/binary/neutron/neutron-metadata-agent/start.sh diff --git a/compose/neutron-agents.yml b/compose/neutron-agents.yml new file mode 100644 index 0000000000..895624dffb --- /dev/null +++ b/compose/neutron-agents.yml @@ -0,0 +1,11 @@ +neutronagents: + image: kollaglue/centos-rdo-neutron-agents:latest + name: neutron-agents + net: "host" + privileged: true + restart: always + volumes: + - /var/run/netns/:/var/run/netns/ + - /lib/modules:/lib/modules:ro + env_file: + - openstack.env diff --git a/compose/neutron-dhcp-agent.yml b/compose/neutron-dhcp-agent.yml deleted file mode 100644 index 8d944c00cc..0000000000 --- a/compose/neutron-dhcp-agent.yml +++ /dev/null @@ -1,12 +0,0 @@ -neutrondhcpagent: - image: kollaglue/centos-rdo-neutron-dhcp-agent:latest - name: neutron-dhcp-agent - net: "host" - privileged: true - restart: always - volumes: - - /run/netns/:/run/netns/:ro - - /proc/1/ns/:/opt/kolla/host_proc/1/ns/:ro - - /lib/modules:/lib/modules:ro - env_file: - - openstack.env diff --git a/compose/neutron-l3-agent.yml b/compose/neutron-l3-agent.yml deleted file mode 100644 index e4c31169f2..0000000000 --- a/compose/neutron-l3-agent.yml +++ /dev/null @@ -1,12 +0,0 @@ -neutronl3agent: - image: kollaglue/centos-rdo-neutron-l3-agent:latest - name: neutron-l3-agent - net: "host" - privileged: true - restart: always - volumes: - - /run/netns/:/run/netns/:ro - - /proc/1/ns/:/opt/kolla/host_proc/1/ns/:ro - - /lib/modules:/lib/modules:ro - env_file: - - openstack.env diff --git a/compose/neutron-linuxbridge-agent.yml b/compose/neutron-linuxbridge-agent.yml index 46f2e68d5c..e8bf237183 100644 --- a/compose/neutron-linuxbridge-agent.yml +++ b/compose/neutron-linuxbridge-agent.yml @@ -6,7 +6,6 @@ neutronlinuxbridgeagent: restart: always volumes: - /run/netns/:/run/netns/:ro - - /proc/1/ns/:/opt/kolla/host_proc/1/ns/:ro - /lib/modules:/lib/modules:ro env_file: - openstack.env diff --git a/compose/neutron-metadata-agent.yml b/compose/neutron-metadata-agent.yml deleted file mode 100644 index b9338f7b66..0000000000 --- a/compose/neutron-metadata-agent.yml +++ /dev/null @@ -1,12 +0,0 @@ -neutronmetadataagent: - image: kollaglue/centos-rdo-neutron-metadata-agent:latest - name: neutron-metadata-agent - net: "host" - privileged: true - restart: always - volumes: - - /run/netns/:/run/netns/:ro - - /proc/1/ns/:/opt/kolla/host_proc/1/ns/:ro - - /lib/modules:/lib/modules:ro - env_file: - - openstack.env diff --git a/docker/centos/binary/neutron/neutron-l3-agent/Dockerfile b/docker/centos/binary/neutron/neutron-agents/Dockerfile similarity index 58% rename from docker/centos/binary/neutron/neutron-l3-agent/Dockerfile rename to docker/centos/binary/neutron/neutron-agents/Dockerfile index 96a05c9c38..546c2a2104 100644 --- a/docker/centos/binary/neutron/neutron-l3-agent/Dockerfile +++ b/docker/centos/binary/neutron/neutron-agents/Dockerfile @@ -1,6 +1,16 @@ FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%neutron-base:%%KOLLA_TAG%% MAINTAINER Kolla Project (https://launchpad.net/kolla) +# Install supervisor +RUN easy_install supervisor + +# Install supervisor-stdout +RUN pip install supervisor-stdout + +# Configure supervisord +RUN mkdir -p /var/log/supervisor/ +COPY supervisord.conf /etc/ + # TODO: SamYaple FWaaS is part of the l3-agent, not a seperate agent that is # why this file is needed. To support FWaaS we cannot have a seperate container # I need to figure out the best way to make this work together @@ -9,6 +19,9 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla) # exec line in the start script. Also all these config options can exist in the # main neutron.conf if we wish COPY fwaas_driver.ini /etc/neutron/ -COPY check.sh start.sh / -CMD ["/start.sh"] +COPY neutron-dhcp-agent/ /opt/kolla/neutron-dhcp-agent +COPY neutron-l3-agent/ /opt/kolla/neutron-l3-agent +COPY neutron-metadata-agent/ /opt/kolla/neutron-metadata-agent + +CMD ["/usr/bin/supervisord"] diff --git a/docker/centos/binary/neutron/neutron-dhcp-agent/build b/docker/centos/binary/neutron/neutron-agents/build similarity index 100% rename from docker/centos/binary/neutron/neutron-dhcp-agent/build rename to docker/centos/binary/neutron/neutron-agents/build diff --git a/docker/centos/binary/neutron/neutron-l3-agent/fwaas_driver.ini b/docker/centos/binary/neutron/neutron-agents/fwaas_driver.ini similarity index 100% rename from docker/centos/binary/neutron/neutron-l3-agent/fwaas_driver.ini rename to docker/centos/binary/neutron/neutron-agents/fwaas_driver.ini diff --git a/docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/check.sh b/docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/check.sh new file mode 120000 index 0000000000..8658a69801 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/check.sh @@ -0,0 +1 @@ +../../../../../common/neutron/neutron-dhcp-agent/check.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/start.sh b/docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/start.sh new file mode 120000 index 0000000000..63dad958d6 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/start.sh @@ -0,0 +1 @@ +../../../../../common/neutron/neutron-dhcp-agent/start.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/check.sh b/docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/check.sh new file mode 120000 index 0000000000..df50ef3901 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/check.sh @@ -0,0 +1 @@ +../../../../../common/neutron/neutron-l3-agent/check.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/fwaas_driver.ini b/docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/fwaas_driver.ini new file mode 120000 index 0000000000..8ea67959c5 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/fwaas_driver.ini @@ -0,0 +1 @@ +../../../../../common/neutron/neutron-l3-agent/fwaas_driver.ini \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/start.sh b/docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/start.sh new file mode 120000 index 0000000000..fa70dec8b1 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/start.sh @@ -0,0 +1 @@ +../../../../../common/neutron/neutron-l3-agent/start.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/check.sh b/docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/check.sh new file mode 120000 index 0000000000..ddbee63083 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/check.sh @@ -0,0 +1 @@ +../../../../../common/neutron/neutron-metadata-agent/check.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/start.sh b/docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/start.sh new file mode 120000 index 0000000000..0de2452ee9 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/start.sh @@ -0,0 +1 @@ +../../../../../common/neutron/neutron-metadata-agent/start.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-agents/supervisord.conf b/docker/centos/binary/neutron/neutron-agents/supervisord.conf new file mode 100644 index 0000000000..2db1af2dc2 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/supervisord.conf @@ -0,0 +1,46 @@ +[unix_http_server] +file = /var/run/supervisor.sock + +[inet_http_server] +port = 127.0.0.1:9001 + +[supervisord] +nodaemon=true +logfile = /var/log/supervisor/supervisord.log +logfile_maxbytes = 200KB +logfile_backups = 1 +pidfile = /var/run/supervisord.pid +childlogdir = /var/log/supervisor + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl = unix:///var/run/supervisor.sock + +[program:neutron-dhcp-agent] +command=/opt/kolla/neutron-dhcp-agent/start.sh +priority=40 +startsec=10 +stderr_events_enabled=true +stdout_events_enabled=true + +[program:neutron-metadata-agent] +command=/opt/kolla/neutron-metadata-agent/start.sh +priority=40 +startsec=10 +stderr_events_enabled=true +stdout_events_enabled=true + +[program:neutron-l3-agent] +command=/opt/kolla/neutron-l3-agent/start.sh +priority=40 +startsec=10 +stderr_events_enabled=true +stdout_events_enabled=true + +[eventlistener:stdout] +command = supervisor_stdout +buffer_size = 100 +events = PROCESS_LOG +result_handler = supervisor_stdout:event_handler diff --git a/docker/centos/binary/neutron/neutron-base/Dockerfile b/docker/centos/binary/neutron/neutron-base/Dockerfile index e316f8a552..edc8679f61 100644 --- a/docker/centos/binary/neutron/neutron-base/Dockerfile +++ b/docker/centos/binary/neutron/neutron-base/Dockerfile @@ -7,12 +7,4 @@ RUN yum -y install openstack-neutron \ python-oslo-policy \ && yum clean all -RUN mkdir -p /opt/kolla/host_proc - -RUN pip install nsenter \ - && ln -s 1 /opt/kolla/host_proc/self - COPY config-neutron.sh config-sudoers.sh /opt/kolla/ - -RUN mv /sbin/ip /opt/kolla/ip -COPY ip_wrapper.py /sbin/ip diff --git a/docker/centos/binary/neutron/neutron-dhcp-agent/Dockerfile b/docker/centos/binary/neutron/neutron-dhcp-agent/Dockerfile deleted file mode 100644 index bbc9354f3a..0000000000 --- a/docker/centos/binary/neutron/neutron-dhcp-agent/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%neutron-base:%%KOLLA_TAG%% -MAINTAINER Kolla Project (https://launchpad.net/kolla) - -COPY check.sh start.sh / - -CMD ["/start.sh"] diff --git a/docker/centos/binary/neutron/neutron-dhcp-agent/check.sh b/docker/centos/binary/neutron/neutron-dhcp-agent/check.sh deleted file mode 120000 index c8efc14c64..0000000000 --- a/docker/centos/binary/neutron/neutron-dhcp-agent/check.sh +++ /dev/null @@ -1 +0,0 @@ -../../../../common/neutron/neutron-dhcp-agent/check.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-dhcp-agent/start.sh b/docker/centos/binary/neutron/neutron-dhcp-agent/start.sh deleted file mode 120000 index 98a2563e9a..0000000000 --- a/docker/centos/binary/neutron/neutron-dhcp-agent/start.sh +++ /dev/null @@ -1 +0,0 @@ -../../../../common/neutron/neutron-dhcp-agent/start.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-l3-agent/build b/docker/centos/binary/neutron/neutron-l3-agent/build deleted file mode 120000 index ec19138031..0000000000 --- a/docker/centos/binary/neutron/neutron-l3-agent/build +++ /dev/null @@ -1 +0,0 @@ -../../../../../tools/build-docker-image \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-l3-agent/check.sh b/docker/centos/binary/neutron/neutron-l3-agent/check.sh deleted file mode 120000 index 7f8ed45cea..0000000000 --- a/docker/centos/binary/neutron/neutron-l3-agent/check.sh +++ /dev/null @@ -1 +0,0 @@ -../../../../common/neutron/neutron-l3-agent/check.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-l3-agent/start.sh b/docker/centos/binary/neutron/neutron-l3-agent/start.sh deleted file mode 120000 index 8d9104a332..0000000000 --- a/docker/centos/binary/neutron/neutron-l3-agent/start.sh +++ /dev/null @@ -1 +0,0 @@ -../../../../common/neutron/neutron-l3-agent/start.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-metadata-agent/Dockerfile b/docker/centos/binary/neutron/neutron-metadata-agent/Dockerfile deleted file mode 100644 index bbc9354f3a..0000000000 --- a/docker/centos/binary/neutron/neutron-metadata-agent/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%neutron-base:%%KOLLA_TAG%% -MAINTAINER Kolla Project (https://launchpad.net/kolla) - -COPY check.sh start.sh / - -CMD ["/start.sh"] diff --git a/docker/centos/binary/neutron/neutron-metadata-agent/build b/docker/centos/binary/neutron/neutron-metadata-agent/build deleted file mode 120000 index ec19138031..0000000000 --- a/docker/centos/binary/neutron/neutron-metadata-agent/build +++ /dev/null @@ -1 +0,0 @@ -../../../../../tools/build-docker-image \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-metadata-agent/check.sh b/docker/centos/binary/neutron/neutron-metadata-agent/check.sh deleted file mode 120000 index 2ac733b838..0000000000 --- a/docker/centos/binary/neutron/neutron-metadata-agent/check.sh +++ /dev/null @@ -1 +0,0 @@ -../../../../common/neutron/neutron-metadata-agent/check.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-metadata-agent/start.sh b/docker/centos/binary/neutron/neutron-metadata-agent/start.sh deleted file mode 120000 index b555e715d8..0000000000 --- a/docker/centos/binary/neutron/neutron-metadata-agent/start.sh +++ /dev/null @@ -1 +0,0 @@ -../../../../common/neutron/neutron-metadata-agent/start.sh \ No newline at end of file diff --git a/docker/common/neutron/neutron-dhcp-agent/start.sh b/docker/common/neutron/neutron-dhcp-agent/start.sh index c3056fdb4d..37182ebcac 100755 --- a/docker/common/neutron/neutron-dhcp-agent/start.sh +++ b/docker/common/neutron/neutron-dhcp-agent/start.sh @@ -79,5 +79,16 @@ dhcp-option-force=26,1450 log-facility=${NEUTRON_LOG_DIR}/neutron-dnsmasq.log EOF +# TODO: SamYaple remove this section for thin neutron containers +# The reason we remove existing namespaces is because network namespaces don't +# persist between container restarts because the network proc mountpoint dies +# when the container mount namespace dies. The mountpoint in /run/netns does +# persist however, and that is all we are cleaning up here. + +# 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 --config-dir /etc/neutron diff --git a/docker/common/neutron/neutron-l3-agent/start.sh b/docker/common/neutron/neutron-l3-agent/start.sh index 4780341fb8..c4fb852050 100755 --- a/docker/common/neutron/neutron-l3-agent/start.sh +++ b/docker/common/neutron/neutron-l3-agent/start.sh @@ -76,5 +76,16 @@ elif [ "${USE_NAMESPACES}" == "true" ] ; then "true" fi +# TODO: SamYaple remove this section for thin neutron containers +# The reason we remove existing namespaces is because network namespaces don't +# persist between container restarts because the network proc mountpoint dies +# when the container mount namespace dies. The mountpoint in /run/netns does +# persist however, and that is all we are cleaning up here. + +# 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 --config-dir /etc/neutron diff --git a/tools/kolla b/tools/kolla index 9235c5677d..62193d9d92 100755 --- a/tools/kolla +++ b/tools/kolla @@ -39,10 +39,8 @@ function process_all { # Defaulting to neutron process nova-compute process neutron-server - process neutron-dhcp-agent - process neutron-l3-agent - process neutron-metadata-agent process neutron-linuxbridge-agent + process neutron-agents fi process heat-api-engine process magnum-api-conductor