Neutron functional tests want to use ubuntu cloud archive but it's
not possible to source the fixup_stuff.sh from a neutron CI setup
script. Break it up so that only the UCA portion can be executed
from neutron.
Change-Id: Ie18833bfa30f1789e63cbe9c86f5ece3453f43fb
| ... | ... |
@@ -45,27 +45,29 @@ fi |
| 45 | 45 |
# where Keystone will try and bind to the port and the port will already be |
| 46 | 46 |
# in use as an ephemeral port by another process. This places an explicit |
| 47 | 47 |
# exception into the Kernel for the Keystone AUTH ports. |
| 48 |
-keystone_ports=${KEYSTONE_AUTH_PORT:-35357},${KEYSTONE_AUTH_PORT_INT:-35358}
|
|
| 49 |
- |
|
| 50 |
-# Only do the reserved ports when available, on some system (like containers) |
|
| 51 |
-# where it's not exposed we are almost pretty sure these ports would be |
|
| 52 |
-# exclusive for our DevStack. |
|
| 53 |
-if sysctl net.ipv4.ip_local_reserved_ports >/dev/null 2>&1; then |
|
| 54 |
- # Get any currently reserved ports, strip off leading whitespace |
|
| 55 |
- reserved_ports=$(sysctl net.ipv4.ip_local_reserved_ports | awk -F'=' '{print $2;}' | sed 's/^ //')
|
|
| 56 |
- |
|
| 57 |
- if [[ -z "${reserved_ports}" ]]; then
|
|
| 58 |
- # If there are no currently reserved ports, reserve the keystone ports |
|
| 59 |
- sudo sysctl -w net.ipv4.ip_local_reserved_ports=${keystone_ports}
|
|
| 48 |
+function fixup_keystone {
|
|
| 49 |
+ keystone_ports=${KEYSTONE_AUTH_PORT:-35357},${KEYSTONE_AUTH_PORT_INT:-35358}
|
|
| 50 |
+ |
|
| 51 |
+ # Only do the reserved ports when available, on some system (like containers) |
|
| 52 |
+ # where it's not exposed we are almost pretty sure these ports would be |
|
| 53 |
+ # exclusive for our DevStack. |
|
| 54 |
+ if sysctl net.ipv4.ip_local_reserved_ports >/dev/null 2>&1; then |
|
| 55 |
+ # Get any currently reserved ports, strip off leading whitespace |
|
| 56 |
+ reserved_ports=$(sysctl net.ipv4.ip_local_reserved_ports | awk -F'=' '{print $2;}' | sed 's/^ //')
|
|
| 57 |
+ |
|
| 58 |
+ if [[ -z "${reserved_ports}" ]]; then
|
|
| 59 |
+ # If there are no currently reserved ports, reserve the keystone ports |
|
| 60 |
+ sudo sysctl -w net.ipv4.ip_local_reserved_ports=${keystone_ports}
|
|
| 61 |
+ else |
|
| 62 |
+ # If there are currently reserved ports, keep those and also reserve the |
|
| 63 |
+ # Keystone specific ports. Duplicate reservations are merged into a single |
|
| 64 |
+ # reservation (or range) automatically by the kernel. |
|
| 65 |
+ sudo sysctl -w net.ipv4.ip_local_reserved_ports=${keystone_ports},${reserved_ports}
|
|
| 66 |
+ fi |
|
| 60 | 67 |
else |
| 61 |
- # If there are currently reserved ports, keep those and also reserve the |
|
| 62 |
- # Keystone specific ports. Duplicate reservations are merged into a single |
|
| 63 |
- # reservation (or range) automatically by the kernel. |
|
| 64 |
- sudo sysctl -w net.ipv4.ip_local_reserved_ports=${keystone_ports},${reserved_ports}
|
|
| 68 |
+ echo_summary "WARNING: unable to reserve keystone ports" |
|
| 65 | 69 |
fi |
| 66 |
-else |
|
| 67 |
- echo_summary "WARNING: unable to reserve keystone ports" |
|
| 68 |
-fi |
|
| 70 |
+} |
|
| 69 | 71 |
|
| 70 | 72 |
# Ubuntu Cloud Archive |
| 71 | 73 |
#--------------------- |
| ... | ... |
@@ -79,8 +81,12 @@ fi |
| 79 | 79 |
# ENABLE_VOLUME_MULTIATTACH is True, we can't use the Pike UCA |
| 80 | 80 |
# because multiattach won't work with those package versions. |
| 81 | 81 |
# We can remove this check when the UCA has libvirt>=3.10. |
| 82 |
-if [[ "${ENABLE_UBUNTU_CLOUD_ARCHIVE}" == "True" && "$DISTRO" = "xenial" && \
|
|
| 83 |
- "${ENABLE_VOLUME_MULTIATTACH}" == "False" ]]; then
|
|
| 82 |
+function fixup_uca {
|
|
| 83 |
+ if [[ "${ENABLE_UBUNTU_CLOUD_ARCHIVE}" == "False" || "$DISTRO" != "xenial" || \
|
|
| 84 |
+ "${ENABLE_VOLUME_MULTIATTACH}" == "True" ]]; then
|
|
| 85 |
+ return |
|
| 86 |
+ fi |
|
| 87 |
+ |
|
| 84 | 88 |
# This pulls in apt-add-repository |
| 85 | 89 |
install_package "software-properties-common" |
| 86 | 90 |
# Use UCA for newer libvirt. Should give us libvirt 2.5.0. |
| ... | ... |
@@ -104,8 +110,7 @@ if [[ "${ENABLE_UBUNTU_CLOUD_ARCHIVE}" == "True" && "$DISTRO" = "xenial" && \
|
| 104 | 104 |
# Force update our APT repos, since we added UCA above. |
| 105 | 105 |
REPOS_UPDATED=False |
| 106 | 106 |
apt_get_update |
| 107 |
-fi |
|
| 108 |
- |
|
| 107 |
+} |
|
| 109 | 108 |
|
| 110 | 109 |
# Python Packages |
| 111 | 110 |
# --------------- |
| ... | ... |
@@ -120,27 +125,32 @@ function get_package_path {
|
| 120 | 120 |
# Pre-install affected packages so we can fix the permissions |
| 121 | 121 |
# These can go away once we are confident that pip 1.4.1+ is available everywhere |
| 122 | 122 |
|
| 123 |
-# Fix prettytable 0.7.2 permissions |
|
| 124 |
-# Don't specify --upgrade so we use the existing package if present |
|
| 125 |
-pip_install 'prettytable>=0.7' |
|
| 126 |
-PACKAGE_DIR=$(get_package_path prettytable) |
|
| 127 |
-# Only fix version 0.7.2 |
|
| 128 |
-dir=$(echo $PACKAGE_DIR/prettytable-0.7.2*) |
|
| 129 |
-if [[ -d $dir ]]; then |
|
| 130 |
- sudo chmod +r $dir/* |
|
| 131 |
-fi |
|
| 123 |
+function fixup_python_packages {
|
|
| 124 |
+ # Fix prettytable 0.7.2 permissions |
|
| 125 |
+ # Don't specify --upgrade so we use the existing package if present |
|
| 126 |
+ pip_install 'prettytable>=0.7' |
|
| 127 |
+ PACKAGE_DIR=$(get_package_path prettytable) |
|
| 128 |
+ # Only fix version 0.7.2 |
|
| 129 |
+ dir=$(echo $PACKAGE_DIR/prettytable-0.7.2*) |
|
| 130 |
+ if [[ -d $dir ]]; then |
|
| 131 |
+ sudo chmod +r $dir/* |
|
| 132 |
+ fi |
|
| 132 | 133 |
|
| 133 |
-# Fix httplib2 0.8 permissions |
|
| 134 |
-# Don't specify --upgrade so we use the existing package if present |
|
| 135 |
-pip_install httplib2 |
|
| 136 |
-PACKAGE_DIR=$(get_package_path httplib2) |
|
| 137 |
-# Only fix version 0.8 |
|
| 138 |
-dir=$(echo $PACKAGE_DIR-0.8*) |
|
| 139 |
-if [[ -d $dir ]]; then |
|
| 140 |
- sudo chmod +r $dir/* |
|
| 141 |
-fi |
|
| 134 |
+ # Fix httplib2 0.8 permissions |
|
| 135 |
+ # Don't specify --upgrade so we use the existing package if present |
|
| 136 |
+ pip_install httplib2 |
|
| 137 |
+ PACKAGE_DIR=$(get_package_path httplib2) |
|
| 138 |
+ # Only fix version 0.8 |
|
| 139 |
+ dir=$(echo $PACKAGE_DIR-0.8*) |
|
| 140 |
+ if [[ -d $dir ]]; then |
|
| 141 |
+ sudo chmod +r $dir/* |
|
| 142 |
+ fi |
|
| 143 |
+} |
|
| 142 | 144 |
|
| 143 |
-if is_fedora; then |
|
| 145 |
+function fixup_fedora {
|
|
| 146 |
+ if ! is_fedora; then |
|
| 147 |
+ return |
|
| 148 |
+ fi |
|
| 144 | 149 |
# Disable selinux to avoid configuring to allow Apache access |
| 145 | 150 |
# to Horizon files (LP#1175444) |
| 146 | 151 |
if selinuxenabled; then |
| ... | ... |
@@ -198,7 +208,7 @@ if is_fedora; then |
| 198 | 198 |
pip_install --upgrade --force-reinstall requests |
| 199 | 199 |
fi |
| 200 | 200 |
fi |
| 201 |
-fi |
|
| 201 |
+} |
|
| 202 | 202 |
|
| 203 | 203 |
# The version of pip(1.5.4) supported by python-virtualenv(1.11.4) has |
| 204 | 204 |
# connection issues under proxy so re-install the latest version using |
| ... | ... |
@@ -222,7 +232,17 @@ fi |
| 222 | 222 |
# install.d/pip-and-virtualenv-source-install/04-install-pip |
| 223 | 223 |
# [2] https://bugzilla.redhat.com/show_bug.cgi?id=1477823 |
| 224 | 224 |
|
| 225 |
-if [[ ! -f /etc/ci/mirror_info.sh ]]; then |
|
| 226 |
- install_package python-virtualenv |
|
| 227 |
- pip_install -U --force-reinstall virtualenv |
|
| 228 |
-fi |
|
| 225 |
+function fixup_virtualenv {
|
|
| 226 |
+ if [[ ! -f /etc/ci/mirror_info.sh ]]; then |
|
| 227 |
+ install_package python-virtualenv |
|
| 228 |
+ pip_install -U --force-reinstall virtualenv |
|
| 229 |
+ fi |
|
| 230 |
+} |
|
| 231 |
+ |
|
| 232 |
+function fixup_all {
|
|
| 233 |
+ fixup_keystone |
|
| 234 |
+ fixup_uca |
|
| 235 |
+ fixup_python_packages |
|
| 236 |
+ fixup_fedora |
|
| 237 |
+ fixup_virtualenv |
|
| 238 |
+} |