Only sysctl reserverd ports when available.

Only set the keystone reserved ports when available, on some system
(like when running under containers) where this sysfs interface is not
exposed we are almost pretty sure these ports would be exclusive for our
devstack.

Change-Id: I06d7d227ae94d564c91c16119e4bbbcc6564a280
This commit is contained in:
Chmouel Boudjnah 2014-10-02 20:58:20 +02:00 committed by Cedric Brandily
parent f33e76bf9b
commit 8fceb49820

View File

@ -50,6 +50,10 @@ fi
# exception into the Kernel for the Keystone AUTH ports. # exception into the Kernel for the Keystone AUTH ports.
keystone_ports=${KEYSTONE_AUTH_PORT:-35357},${KEYSTONE_AUTH_PORT_INT:-35358} keystone_ports=${KEYSTONE_AUTH_PORT:-35357},${KEYSTONE_AUTH_PORT_INT:-35358}
# only do the reserved ports when available, on some system (like containers)
# where it's not exposed we are almost pretty sure these ports would be
# exclusive for our devstack.
if sysctl net.ipv4.ip_local_reserved_ports >/dev/null 2>&1; then
# Get any currently reserved ports, strip off leading whitespace # Get any currently reserved ports, strip off leading whitespace
reserved_ports=$(sysctl net.ipv4.ip_local_reserved_ports | awk -F'=' '{print $2;}' | sed 's/^ //') reserved_ports=$(sysctl net.ipv4.ip_local_reserved_ports | awk -F'=' '{print $2;}' | sed 's/^ //')
@ -62,6 +66,9 @@ else
# reservation (or range) automatically by the kernel. # reservation (or range) automatically by the kernel.
sudo sysctl -w net.ipv4.ip_local_reserved_ports=${keystone_ports},${reserved_ports} sudo sysctl -w net.ipv4.ip_local_reserved_ports=${keystone_ports},${reserved_ports}
fi fi
else
echo_summary "WARNING: unable to reserve keystone ports"
fi
# Python Packages # Python Packages