From 85ea344d4ba3da78d0ca8c707c576fb54d4b1fd7 Mon Sep 17 00:00:00 2001 From: Harm Weites Date: Thu, 2 Jul 2015 20:50:23 +0200 Subject: [PATCH] Add config-internal/config-external to Neutron containers Partially Implements: Blueprint standard-start Change-Id: Ic7334c1bed2a2b5055bd5c1e39b9f9ac32c30c6a --- .../neutron-dhcp-agent/config-external.sh | 1 + .../neutron-dhcp-agent/config-internal.sh | 1 + .../neutron-l3-agent/config-external.sh | 1 + .../neutron-l3-agent/config-internal.sh | 1 + .../neutron-metadata-agent/config-external.sh | 1 + .../neutron-metadata-agent/config-internal.sh | 1 + .../neutron-linuxbridge-agent/Dockerfile | 2 + .../config-external.sh | 1 + .../config-internal.sh | 1 + .../neutron-openvswitch-agent/Dockerfile | 2 + .../config-external.sh | 1 + .../config-internal.sh | 1 + .../binary/neutron/neutron-server/Dockerfile | 1 + .../neutron/neutron-server/config-external.sh | 1 + .../neutron/neutron-server/config-internal.sh | 1 + .../neutron-dhcp-agent/config-external.sh | 13 ++ .../neutron-dhcp-agent/config-internal.sh | 94 ++++++++++++++ .../neutron/neutron-dhcp-agent/start.sh | 120 +++++------------- .../neutron-l3-agent/config-external.sh | 13 ++ .../neutron-l3-agent/config-internal.sh | 91 +++++++++++++ .../common/neutron/neutron-l3-agent/start.sh | 117 +++++------------ .../config-external.sh | 10 ++ .../config-internal.sh | 29 +++++ .../neutron-linuxbridge-agent/start.sh | 32 ++--- .../neutron-metadata-agent/config-external.sh | 13 ++ .../neutron-metadata-agent/config-internal.sh | 74 +++++++++++ .../neutron/neutron-metadata-agent/start.sh | 100 +++++---------- .../config-external.sh | 10 ++ .../config-internal.sh | 45 +++++++ .../neutron-openvswitch-agent/start.sh | 48 ++----- .../neutron/neutron-server/config-external.sh | 10 ++ .../neutron/neutron-server/config-internal.sh | 98 ++++++++++++++ docker/common/neutron/neutron-server/start.sh | 104 ++------------- 33 files changed, 645 insertions(+), 393 deletions(-) create mode 120000 docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/config-external.sh create mode 120000 docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/config-internal.sh create mode 120000 docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/config-external.sh create mode 120000 docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/config-internal.sh create mode 120000 docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/config-external.sh create mode 120000 docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/config-internal.sh create mode 120000 docker/centos/binary/neutron/neutron-linuxbridge-agent/config-external.sh create mode 120000 docker/centos/binary/neutron/neutron-linuxbridge-agent/config-internal.sh create mode 120000 docker/centos/binary/neutron/neutron-openvswitch-agent/config-external.sh create mode 120000 docker/centos/binary/neutron/neutron-openvswitch-agent/config-internal.sh create mode 120000 docker/centos/binary/neutron/neutron-server/config-external.sh create mode 120000 docker/centos/binary/neutron/neutron-server/config-internal.sh create mode 100755 docker/common/neutron/neutron-dhcp-agent/config-external.sh create mode 100755 docker/common/neutron/neutron-dhcp-agent/config-internal.sh create mode 100755 docker/common/neutron/neutron-l3-agent/config-external.sh create mode 100755 docker/common/neutron/neutron-l3-agent/config-internal.sh create mode 100755 docker/common/neutron/neutron-linuxbridge-agent/config-external.sh create mode 100755 docker/common/neutron/neutron-linuxbridge-agent/config-internal.sh create mode 100755 docker/common/neutron/neutron-metadata-agent/config-external.sh create mode 100755 docker/common/neutron/neutron-metadata-agent/config-internal.sh create mode 100755 docker/common/neutron/neutron-openvswitch-agent/config-external.sh create mode 100755 docker/common/neutron/neutron-openvswitch-agent/config-internal.sh create mode 100755 docker/common/neutron/neutron-server/config-external.sh create mode 100755 docker/common/neutron/neutron-server/config-internal.sh diff --git a/docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/config-external.sh b/docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/config-external.sh new file mode 120000 index 0000000000..680eee8757 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/config-external.sh @@ -0,0 +1 @@ +../../../../../common/neutron/neutron-dhcp-agent/config-external.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/config-internal.sh b/docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/config-internal.sh new file mode 120000 index 0000000000..65cd887042 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/neutron-dhcp-agent/config-internal.sh @@ -0,0 +1 @@ +../../../../../common/neutron/neutron-dhcp-agent/config-internal.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/config-external.sh b/docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/config-external.sh new file mode 120000 index 0000000000..f4530afd99 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/config-external.sh @@ -0,0 +1 @@ +../../../../../common/neutron/neutron-l3-agent/config-external.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/config-internal.sh b/docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/config-internal.sh new file mode 120000 index 0000000000..73c2ccb551 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/neutron-l3-agent/config-internal.sh @@ -0,0 +1 @@ +../../../../../common/neutron/neutron-l3-agent/config-internal.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/config-external.sh b/docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/config-external.sh new file mode 120000 index 0000000000..a5c3ac24a0 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/config-external.sh @@ -0,0 +1 @@ +../../../../../common/neutron/neutron-metadata-agent/config-external.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/config-internal.sh b/docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/config-internal.sh new file mode 120000 index 0000000000..23d60c52f8 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/neutron-metadata-agent/config-internal.sh @@ -0,0 +1 @@ +../../../../../common/neutron/neutron-metadata-agent/config-internal.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-linuxbridge-agent/Dockerfile b/docker/centos/binary/neutron/neutron-linuxbridge-agent/Dockerfile index 702e16b42b..1ad5d82f39 100644 --- a/docker/centos/binary/neutron/neutron-linuxbridge-agent/Dockerfile +++ b/docker/centos/binary/neutron/neutron-linuxbridge-agent/Dockerfile @@ -7,4 +7,6 @@ RUN yum install -y openstack-neutron-linuxbridge && \ COPY check.sh start.sh / +COPY config-internal.sh config-external.sh /opt/kolla/ + CMD ["/start.sh"] diff --git a/docker/centos/binary/neutron/neutron-linuxbridge-agent/config-external.sh b/docker/centos/binary/neutron/neutron-linuxbridge-agent/config-external.sh new file mode 120000 index 0000000000..6bd77d67dc --- /dev/null +++ b/docker/centos/binary/neutron/neutron-linuxbridge-agent/config-external.sh @@ -0,0 +1 @@ +../../../../common/neutron/neutron-linuxbridge-agent/config-external.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-linuxbridge-agent/config-internal.sh b/docker/centos/binary/neutron/neutron-linuxbridge-agent/config-internal.sh new file mode 120000 index 0000000000..faacbd3ed9 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-linuxbridge-agent/config-internal.sh @@ -0,0 +1 @@ +../../../../common/neutron/neutron-linuxbridge-agent/config-internal.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-openvswitch-agent/Dockerfile b/docker/centos/binary/neutron/neutron-openvswitch-agent/Dockerfile index 551d81a539..b18ec9d203 100644 --- a/docker/centos/binary/neutron/neutron-openvswitch-agent/Dockerfile +++ b/docker/centos/binary/neutron/neutron-openvswitch-agent/Dockerfile @@ -8,4 +8,6 @@ RUN yum install -y openstack-neutron-openvswitch \ COPY check.sh start.sh / +COPY config-internal.sh config-external.sh /opt/kolla/ + CMD ["/start.sh"] diff --git a/docker/centos/binary/neutron/neutron-openvswitch-agent/config-external.sh b/docker/centos/binary/neutron/neutron-openvswitch-agent/config-external.sh new file mode 120000 index 0000000000..14354b71a0 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-openvswitch-agent/config-external.sh @@ -0,0 +1 @@ +../../../../common/neutron/neutron-openvswitch-agent/config-external.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-openvswitch-agent/config-internal.sh b/docker/centos/binary/neutron/neutron-openvswitch-agent/config-internal.sh new file mode 120000 index 0000000000..1d7c6c6bff --- /dev/null +++ b/docker/centos/binary/neutron/neutron-openvswitch-agent/config-internal.sh @@ -0,0 +1 @@ +../../../../common/neutron/neutron-openvswitch-agent/config-internal.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-server/Dockerfile b/docker/centos/binary/neutron/neutron-server/Dockerfile index 0bfd3cf4b3..75f7c066f9 100644 --- a/docker/centos/binary/neutron/neutron-server/Dockerfile +++ b/docker/centos/binary/neutron/neutron-server/Dockerfile @@ -6,5 +6,6 @@ RUN yum install -y which && \ yum clean all COPY check.sh start.sh / +COPY config-internal.sh config-external.sh /opt/kolla/ CMD ["/start.sh"] diff --git a/docker/centos/binary/neutron/neutron-server/config-external.sh b/docker/centos/binary/neutron/neutron-server/config-external.sh new file mode 120000 index 0000000000..b8d7792ced --- /dev/null +++ b/docker/centos/binary/neutron/neutron-server/config-external.sh @@ -0,0 +1 @@ +../../../../common/neutron/neutron-server/config-external.sh \ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-server/config-internal.sh b/docker/centos/binary/neutron/neutron-server/config-internal.sh new file mode 120000 index 0000000000..6c3a8a112b --- /dev/null +++ b/docker/centos/binary/neutron/neutron-server/config-internal.sh @@ -0,0 +1 @@ +../../../../common/neutron/neutron-server/config-internal.sh \ No newline at end of file diff --git a/docker/common/neutron/neutron-dhcp-agent/config-external.sh b/docker/common/neutron/neutron-dhcp-agent/config-external.sh new file mode 100755 index 0000000000..ccf5cbe78a --- /dev/null +++ b/docker/common/neutron/neutron-dhcp-agent/config-external.sh @@ -0,0 +1,13 @@ +#!/bin/bash +SOURCES="/opt/kolla/neutron-dhcp-agent/neutron.conf /opt/kolla/neutron-dhcp-agent/dhcp_agent.ini /opt/kolla/neutron-dhcp-agent/dnsmasq.conf" +TARGET="/etc/neutron/" +OWNER="neutron" + +for f in $SOURCES; do + if [[ -f "$f" ]]; then + fname=$(basename $f) + cp $f $TARGET + chown ${OWNER}: $TARGET/$fname + chmod 0644 $TARGET/$fname + fi +done diff --git a/docker/common/neutron/neutron-dhcp-agent/config-internal.sh b/docker/common/neutron/neutron-dhcp-agent/config-internal.sh new file mode 100755 index 0000000000..37182ebcac --- /dev/null +++ b/docker/common/neutron/neutron-dhcp-agent/config-internal.sh @@ -0,0 +1,94 @@ +#!/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} < ${DNSMASQ_CONFIG_FILE} < /dev/null; then + ovs-vsctl add-br ${NEUTRON_FLAT_NETWORK_INTERFACE} +fi + +cfg=/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini + +# Configure ml2_conf.ini +if [[ ${TYPE_DRIVERS} =~ vxlan ]]; then + crudini --set $cfg \ + vxlan \ + local_ip \ + "${PUBLIC_IP}" +fi + +crudini --set $cfg \ + ovs \ + bridge_mappings \ + "${NEUTRON_FLAT_NETWORK_NAME}:${NEUTRON_FLAT_NETWORK_INTERFACE}" + +crudini --set $cfg \ + ovs \ + tenant_network_type \ + "${TENANT_NETWORK_TYPES}" + +if [[ ${TENANT_NETWORK_TYPES} =~ "vlan" ]];then + crudini --set $cfg \ + ovs \ + network_vlan_ranges \ + "${NEUTRON_VLAN_NETWORK_NAME}:${NEUTRON_NETWORK_VLAN_RANGES}" +fi + +exec /usr/bin/neutron-openvswitch-agent --config-file /etc/neutron/neutron.conf --config-file $cfg diff --git a/docker/common/neutron/neutron-openvswitch-agent/start.sh b/docker/common/neutron/neutron-openvswitch-agent/start.sh index 8c4d1a0371..6c2add489f 100755 --- a/docker/common/neutron/neutron-openvswitch-agent/start.sh +++ b/docker/common/neutron/neutron-openvswitch-agent/start.sh @@ -1,45 +1,13 @@ #!/bin/bash +set -o errexit -set -e +CMD="/usr/bin/neutron-openvswitch-agent" +ARGS="--config-file /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini" -. /opt/kolla/config-neutron.sh -. /opt/kolla/config-sudoers.sh +# Loading common functions. +source /opt/kolla/kolla-common.sh -: ${NEUTRON_FLAT_NETWORK_NAME:=physnet1} -: ${NEUTRON_FLAT_NETWORK_INTERFACE:=eth1} +# Config-internal script exec out of this function, it does not return here. +set_configs -check_required_vars PUBLIC_IP NEUTRON_FLAT_NETWORK_NAME \ - NEUTRON_FLAT_NETWORK_INTERFACE - -if ! ovs-vsctl show |grep ${NEUTRON_FLAT_NETWORK_INTERFACE} > /dev/null; then - ovs-vsctl add-br ${NEUTRON_FLAT_NETWORK_INTERFACE} -fi - -cfg=/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini - -# Configure ml2_conf.ini -if [[ ${TYPE_DRIVERS} =~ vxlan ]]; then - crudini --set $cfg \ - vxlan \ - local_ip \ - "${PUBLIC_IP}" -fi - -crudini --set $cfg \ - ovs \ - bridge_mappings \ - "${NEUTRON_FLAT_NETWORK_NAME}:${NEUTRON_FLAT_NETWORK_INTERFACE}" - -crudini --set $cfg \ - ovs \ - tenant_network_type \ - "${TENANT_NETWORK_TYPES}" - -if [[ ${TENANT_NETWORK_TYPES} =~ "vlan" ]];then - crudini --set $cfg \ - ovs \ - network_vlan_ranges \ - "${NEUTRON_VLAN_NETWORK_NAME}:${NEUTRON_NETWORK_VLAN_RANGES}" -fi - -exec /usr/bin/neutron-openvswitch-agent --config-file /etc/neutron/neutron.conf --config-file $cfg +exec $CMD $ARGS diff --git a/docker/common/neutron/neutron-server/config-external.sh b/docker/common/neutron/neutron-server/config-external.sh new file mode 100755 index 0000000000..83cd33ba53 --- /dev/null +++ b/docker/common/neutron/neutron-server/config-external.sh @@ -0,0 +1,10 @@ +#!/bin/bash +SOURCE="/opt/kolla/neutron-server/neutron.conf" +TARGET="/etc/neutron/neutron.conf" +OWNER="neutron" + +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker/common/neutron/neutron-server/config-internal.sh b/docker/common/neutron/neutron-server/config-internal.sh new file mode 100755 index 0000000000..fb971083f5 --- /dev/null +++ b/docker/common/neutron/neutron-server/config-internal.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 <