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
34 lines
1.1 KiB
Plaintext
34 lines
1.1 KiB
Plaintext
<%- | String $image_name = '', String $bind_socket = '' | -%>
|
|
#!/bin/bash
|
|
|
|
export DOCKER_HOST="<%=$bind_socket%>"
|
|
# we want to "eat" the "start" command given by neutron and run
|
|
# this in the foreground.
|
|
shift
|
|
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-dibbler-${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/dibbler-client run $ARGS
|