From 13062e23e86b5d86020949754540460cb5b0b4fe Mon Sep 17 00:00:00 2001 From: Sam Yaple Date: Wed, 13 May 2015 06:46:24 -0500 Subject: Restructure builds to allow more flexibility As a restructure, nothing is changed from the original behaviour and naming despite the file structure changing. The symlinks to build had to be updated generating lots of "deleted" and "new_file". The new structure is: docker/${base_distro}/${type}/${container} base_distro == centos, ubuntu, fedora, etc type == source, binary, rdo type rdo is a symlink to binary for backwards compatibility Two new flags are added to the build-all script to support the ability to support different base distros and a flag to support binary or source containers. There are several added folders that are empty to hold the directory structure for future containers of these types. To use a prefix other than centos-rdo- you can set PREFIX in the toplevel directory .buildconf file Change-Id: Ifc7bac0d827470f506c8b5c004a833da9ce13b90 --- .../binary/neutron/neutron-agents/Dockerfile | 39 ++++ docker/centos/binary/neutron/neutron-agents/build | 1 + .../check-scripts/check-dhcp-agent.sh | 13 ++ .../neutron-agents/check-scripts/check-l3-agent.sh | 13 ++ .../check-scripts/check-linuxbridge-agent.sh | 13 ++ .../check-scripts/check-metadata-agent.sh | 13 ++ .../config-scripts/config-dhcp-agent.sh | 88 +++++++++ .../config-scripts/config-l3-agent.sh | 85 +++++++++ .../config-scripts/config-linuxbridge-agent.sh | 29 +++ .../config-scripts/config-metadata-agent.sh | 74 ++++++++ .../config-scripts/config-sudoers.sh | 12 ++ .../binary/neutron/neutron-agents/fwaas_driver.ini | 3 + .../binary/neutron/neutron-agents/supervisord.conf | 53 ++++++ .../centos/binary/neutron/neutron-base/Dockerfile | 7 + docker/centos/binary/neutron/neutron-base/build | 1 + .../binary/neutron/neutron-base/config-neutron.sh | 210 +++++++++++++++++++++ .../binary/neutron/neutron-server/Dockerfile | 13 ++ docker/centos/binary/neutron/neutron-server/build | 1 + .../centos/binary/neutron/neutron-server/check.sh | 17 ++ .../centos/binary/neutron/neutron-server/start.sh | 98 ++++++++++ 20 files changed, 783 insertions(+) create mode 100644 docker/centos/binary/neutron/neutron-agents/Dockerfile create mode 120000 docker/centos/binary/neutron/neutron-agents/build create mode 100755 docker/centos/binary/neutron/neutron-agents/check-scripts/check-dhcp-agent.sh create mode 100755 docker/centos/binary/neutron/neutron-agents/check-scripts/check-l3-agent.sh create mode 100755 docker/centos/binary/neutron/neutron-agents/check-scripts/check-linuxbridge-agent.sh create mode 100755 docker/centos/binary/neutron/neutron-agents/check-scripts/check-metadata-agent.sh create mode 100755 docker/centos/binary/neutron/neutron-agents/config-scripts/config-dhcp-agent.sh create mode 100755 docker/centos/binary/neutron/neutron-agents/config-scripts/config-l3-agent.sh create mode 100755 docker/centos/binary/neutron/neutron-agents/config-scripts/config-linuxbridge-agent.sh create mode 100755 docker/centos/binary/neutron/neutron-agents/config-scripts/config-metadata-agent.sh create mode 100755 docker/centos/binary/neutron/neutron-agents/config-scripts/config-sudoers.sh create mode 100644 docker/centos/binary/neutron/neutron-agents/fwaas_driver.ini create mode 100644 docker/centos/binary/neutron/neutron-agents/supervisord.conf create mode 100644 docker/centos/binary/neutron/neutron-base/Dockerfile create mode 120000 docker/centos/binary/neutron/neutron-base/build create mode 100644 docker/centos/binary/neutron/neutron-base/config-neutron.sh create mode 100644 docker/centos/binary/neutron/neutron-server/Dockerfile create mode 120000 docker/centos/binary/neutron/neutron-server/build create mode 100755 docker/centos/binary/neutron/neutron-server/check.sh create mode 100755 docker/centos/binary/neutron/neutron-server/start.sh (limited to 'docker/centos/binary/neutron') diff --git a/docker/centos/binary/neutron/neutron-agents/Dockerfile b/docker/centos/binary/neutron/neutron-agents/Dockerfile new file mode 100644 index 000000000..89ce874bb --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/Dockerfile @@ -0,0 +1,39 @@ +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 + +# Install required packages +RUN yum install -y openstack-neutron openstack-neutron-linuxbridge \ + net-tools \ + && yum clean all + +# Add config scripts +ADD config-scripts/config-linuxbridge-agent.sh /opt/kolla/neutron/ +ADD config-scripts/config-dhcp-agent.sh /opt/kolla/neutron/ +ADD config-scripts/config-l3-agent.sh /opt/kolla/neutron/ +ADD config-scripts/config-metadata-agent.sh /opt/kolla/neutron/ +ADD config-scripts/config-sudoers.sh /opt/kolla/ + +# Add check scripts +ADD check-scripts/check-linuxbridge-agent.sh /opt/kolla/neutron/ +ADD check-scripts/check-dhcp-agent.sh /opt/kolla/neutron/ +ADD check-scripts/check-l3-agent.sh /opt/kolla/neutron/ +ADD check-scripts/check-metadata-agent.sh /opt/kolla/neutron/ + +# This is needed to workaround a problem with the agents exiting if the +# file is not present. This file really shouldn't need to be present and +# implies a configuration problem somewhere else in the code base, but +# we are out of time. +COPY fwaas_driver.ini /etc/neutron/ + +# Configure supervisord +RUN mkdir -p /var/log/supervisor/ +ADD supervisord.conf /etc/ + +# Start supervisor +CMD ["/usr/bin/supervisord"] diff --git a/docker/centos/binary/neutron/neutron-agents/build b/docker/centos/binary/neutron/neutron-agents/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-agents/check-scripts/check-dhcp-agent.sh b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-dhcp-agent.sh new file mode 100755 index 000000000..7dda736ef --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-dhcp-agent.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +RES=0 + +check=$(/usr/bin/neutron agent-list | awk '/ DHCP / {print $9}') +error="ERROR: Neutron DHCP Agent is not alive." + +if [[ $check != ":-)" ]]; then + echo $error >&2 + RES=1 +fi + +exit $RES diff --git a/docker/centos/binary/neutron/neutron-agents/check-scripts/check-l3-agent.sh b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-l3-agent.sh new file mode 100755 index 000000000..d32c1e272 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-l3-agent.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +RES=0 + +check=$(/usr/bin/neutron agent-list | awk '/ L3 / {print $9}') +error="ERROR: Neutron L3 Agent is not alive." + +if [[ $check != ":-)" ]]; then + echo $error >&2 + RES=1 +fi + +exit $RES diff --git a/docker/centos/binary/neutron/neutron-agents/check-scripts/check-linuxbridge-agent.sh b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-linuxbridge-agent.sh new file mode 100755 index 000000000..4485fc1ec --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-linuxbridge-agent.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +RES=0 + +check=$(/usr/bin/neutron agent-list | awk '/ Linux / {print $10}') +error="ERROR: Neutron Linux Bridge agent is not alive." + +if [[ $check != ":-)" ]]; then + echo $error >&2 + RES=1 +fi + +exit $RES diff --git a/docker/centos/binary/neutron/neutron-agents/check-scripts/check-metadata-agent.sh b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-metadata-agent.sh new file mode 100755 index 000000000..fd1c6812b --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-metadata-agent.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +RES=0 + +check=$(/usr/bin/neutron agent-list | awk '/ Metadata / {print $9}') +error="ERROR: Neutron Metadata Agent is not alive." + +if [[ $check != ":-)" ]]; then + echo $error >&2 + RES=1 +fi + +exit $RES diff --git a/docker/centos/binary/neutron/neutron-agents/config-scripts/config-dhcp-agent.sh b/docker/centos/binary/neutron/neutron-agents/config-scripts/config-dhcp-agent.sh new file mode 100755 index 000000000..1295d9c57 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/config-scripts/config-dhcp-agent.sh @@ -0,0 +1,88 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-neutron.sh +. /opt/kolla/config-sudoers.sh + +: ${DHCP_DRIVER:=neutron.agent.linux.dhcp.Dnsmasq} +: ${USE_NAMESPACES:=true} +: ${DELETE_NAMESPACES:=true} +: ${DNSMASQ_CONFIG_FILE:=/etc/neutron/dnsmasq/dnsmasq-neutron.conf} +: ${ROOT_HELPER:=sudo neutron-rootwrap /etc/neutron/rootwrap.conf} + +mkdir -p $(dirname $DNSMASQ_CONFIG_FILE) + +check_required_vars VERBOSE_LOGGING DEBUG_LOGGING MECHANISM_DRIVERS \ + DHCP_DRIVER USE_NAMESPACES DELETE_NAMESPACES \ + NEUTRON_LOG_DIR DNSMASQ_CONFIG_FILE \ + +cfg=/etc/neutron/dhcp_agent.ini +neutron_conf=/etc/neutron/neutron.conf + +# Workaround bug in dhclient in cirros images which does not correctly +# handle setting checksums of packets when using hardware with checksum +# offloading. See: +# https://www.rdoproject.org/forum/discussion/567/packstack-allinone-grizzly-cirros-image-cannot-get-a-dhcp-address-when-a-centos-image-can/p1 + +/usr/sbin/iptables -A POSTROUTING -t mangle -p udp --dport bootpc \ + -j CHECKSUM --checksum-fill + +if [[ ${MECHANISM_DRIVERS} =~ linuxbridge ]]; then + interface_driver="neutron.agent.linux.interface.BridgeInterfaceDriver" +elif [[ ${MECHANISM_DRIVERS} == "openvswitch" ]]; then + interface_driver="neutron.agent.linux.interface.OVSInterfaceDriver" +fi + +# Logging +crudini --set $neutron_conf \ + DEFAULT \ + log_file \ + "${NEUTRON_DHCP_AGENT_LOG_FILE}" + +# Configure dhcp_agent.ini +crudini --set $cfg \ + DEFAULT \ + verbose \ + "${VERBOSE_LOGGING}" +crudini --set $cfg \ + DEFAULT \ + debug \ + "${DEBUG_LOGGING}" +crudini --set $cfg \ + DEFAULT \ + interface_driver \ + "$interface_driver" +crudini --set $cfg \ + DEFAULT \ + dhcp_driver \ + "${DHCP_DRIVER}" +crudini --set $cfg \ + DEFAULT \ + use_namespaces \ + "${USE_NAMESPACES}" +crudini --set $cfg \ + DEFAULT \ + delete_namespaces \ + "${DELETE_NAMESPACES}" +crudini --set $cfg \ + DEFAULT \ + dnsmasq_config_file \ + "${DNSMASQ_CONFIG_FILE}" +crudini --set $cfg \ + DEFAULT \ + root_helper \ + "${ROOT_HELPER}" + +cat > ${DNSMASQ_CONFIG_FILE} < /openrc < /dev/null; then + echo "ERROR: keystone token-get failed" >&2 + RES=1 +else + if ! neutron ext-list > /dev/null; then + echo "ERROR: neutron ext-list failed" >&2 + RES=1 + fi +fi + +exit $RES + diff --git a/docker/centos/binary/neutron/neutron-server/start.sh b/docker/centos/binary/neutron/neutron-server/start.sh new file mode 100755 index 000000000..aaaa7a994 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-server/start.sh @@ -0,0 +1,98 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-neutron.sh + +: ${NEUTRON_FLAT_NETWORK_NAME:=physnet1} +: ${NEUTRON_FLAT_NETWORK_INTERFACE:=eth1} + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + KEYSTONE_AUTH_PROTOCOL NOVA_API_SERVICE_HOST \ + NOVA_KEYSTONE_USER NOVA_KEYSTONE_PASSWORD \ + NEUTRON_DB_NAME NEUTRON_DB_USER NEUTRON_DB_PASSWORD \ + NEUTRON_KEYSTONE_USER NEUTRON_KEYSTONE_PASSWORD \ + ADMIN_TENANT_NAME NEUTRON_SERVER_SERVICE_HOST \ + PUBLIC_IP NEUTRON_DB_PASSWORD +fail_unless_os_service_running keystone +fail_unless_db + +mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <