684521fc84
Neutron uses namespaces with different prefixes depending on configuration and the nature of the resource. This patch changes the wrappers to use the "ip netns identify" command to determine the target namespace for the sidecar instead of trying to guess from the command line options. Change-Id: If58bb9dabebf201b592fb450a663ae2f24374e00 Closes-Bug: #1773823
31 lines
979 B
Plaintext
31 lines
979 B
Plaintext
<%- | String $image_name = '', String $bind_socket = '' | -%>
|
|
#!/bin/bash
|
|
|
|
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 ...
|
|
NETNS=$(ip netns identify)
|
|
NAME=neutron-dnsmasq-${NETNS}
|
|
|
|
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 ${NETNS} /usr/sbin/dnsmasq -k $ARGS
|