neutron/tools/generate_dhclient_script_for_fullstack.sh
Jakub Libosvar bc979efdb8 fullstack: Don't let dhcp agents failover
It turned out dhcp tests work only because agents are considered dead
after 10 seconds while they report to server every 60 seconds. This led
to calling network resync after agent revival and hiding the fact dhcp
agent is not capable of receiving any amqp messages.

This patch sets the report interval of agents to the half of
agent_down_time on server side and uses eventlet dhcp agent in order to
trigger eventlet monkey patching code.

Eventlet was behind the failure with messages not getting processed. As
[1] notes: "Note: If the “eventlet” executor is used, the threading and
time library need to be monkeypatched."

Because each port calls dhclient to obtain IP address and each dhclient
instance overwrites /etc/resolv.conf there was added a script that
generates fullstack-dhclient-script from an existing dhclient-script
before starting fulltstack tests. This generated script is passed to
each dhclient process running in fake fullstack machine using -sf
parameter.

[1] https://docs.openstack.org/developer/oslo.messaging/server.html

Related-bug: 1453350

Change-Id: I0336176b9c364fe3a95be5cef9e7a3af1ef9d7e9
2017-04-20 14:04:50 +00:00

29 lines
896 B
Bash
Executable File

#!/bin/bash
MAKE_RESOLV_CONF_FUNCTION=make_resolv_conf
USAGE="$0 <path to virtual environment to place executable>
The script takes existing dhclient-script and makes $MAKE_RESOLV_CONF_FUNCTION function a noop function.
"
if [ $# -lt 1 ]; then
echo "Path to virtual environment directory is a required parameter."
echo $USAGE
exit 2
fi
VENV_DIR=$1
DHCLIENT_SCRIPT_NAME=dhclient-script
DHCLIENT_PATH=$(which $DHCLIENT_SCRIPT_NAME)
FULLSTACK_DHCLIENT_SCRIPT=$VENV_DIR/bin/fullstack-dhclient-script
if [ -n "$DHCLIENT_PATH" ]; then
# Return from make_resolv_conf function immediately. This will cause
# that /etc/resolv.conf will not be updated by fake fullstack machines.
sed "/^$MAKE_RESOLV_CONF_FUNCTION()/a\ return" $DHCLIENT_PATH > $FULLSTACK_DHCLIENT_SCRIPT
chmod +x $FULLSTACK_DHCLIENT_SCRIPT
else
echo "$DHCLIENT_SCRIPT_NAME not found."
exit 1
fi