puppet-tripleo/templates/neutron/radvd.epp
Brent Eagles 015c9b757a Adding wrapper scripts for neutron agent subprocesses
The neutron agents use subprocesses like dnsmasq and keepalived as part
of their implementation. Running these "subprocesses" in separate
containers prevent dataplane breakages/unnecessary failover on agent
container restart.

Also amends docker daemon options to allow including additional unix
domain sockets to bind to the docker daemon. The paths can be mounted by
containers that launch containers instead of mounting /run/docker.sock.
This avoids issues if the docker daemon is restarted while the containers
are running.

Related-Bug: #1749209
Change-Id: Icd4c24ac686d957391548a04722266cefc1bce27
2018-04-30 21:58:29 -02:30

31 lines
1.1 KiB
Plaintext

<%- | String $image_name = '', String $bind_socket = '' | -%>
#!/bin/bash
export DOCKER_HOST="unix:///var/run/docker_container_mount/docker.sock"
export DOCKER_HOST="<%=$bind_socket%>"
ARGS="$@"
# Extract the network namespace UUID from the command line args provided by
# neutron. Typically of the form (with dnsmasq as an example):
#
# dnsmasq --no-hosts --no-resolv --except-interface=lo \
# --pid-file=/var/lib/neutron/dhcp/317716b8-919a-4a6f-8db1-78128ec3b100/pid \
# --dhcp-hostsfile=/var/lib/neutron/dhcp/317716b8-919a-4a6f-8db1-78128ec3b100/host ...
NETWORK_ID=$(echo $ARGS| awk '{if (match($0, /(\w{8}-\w{4}-\w{4}-\w{4}-\w{12})/,m)) print m[0] }')
NAME=neutron-radvd-${NETWORK_ID}
docker stop $NAME || true
docker rm -f $NAME || true
docker run --detach \
-v /var/lib/config-data/puppet-generated/neutron/etc/neutron:/etc/neutron:ro \
-v /run/netns:/run/netns:shared \
-v /var/lib/neutron:/var/lib/neutron \
--net host \
--pid host \
--privileged \
--rm=true \
-u root \
--name $NAME \
<%=$image_name%> \
ip netns exec qrouter-${NETWORK_ID} /usr/sbin/radvd -n $ARGS