
Currently, we use a simple logic for the client scripts to find libraries, configuration files, etc. We know they will be copied to the autostart directory from where TOP_DIR is one step up. If a user ever tried to run a script in its original location (e.g. in scripts/ubuntu), this logic would fail. This has been a theoretical problem as long as users just used osbash.sh or st.py to run the scripts. But if users would like to run extra scripts, logging in to the nodes and running the scripts where they find them would be the most natural way to do it. Right now, the main use case is the heat service which is not installed by default but can be installed at a later time if so desired -- with the gotcha described above. As more services are becoming optional add-ons to the install-guide, this becomes an issue. This patch installs a new logic: if a script finds a file named TOP_DIR in its parent dir, it will use the file's contents as a pointer to the TOP_DIR location. TOP_DIR is a file rather than a symlink because the file needs to work on Windows file systems as well. The file lives in the parent directory rather than the script directory because that reduces the number of such files that are required. This becomes more relevant once we store additional services along with their supporting files in extras/<service_name>/. Change-Id: Ib0ccb108e5246ff8e06d87730ce11704d719fb75
76 lines
2.3 KiB
Bash
Executable File
76 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -o errexit -o nounset
|
|
TOP_DIR=$(cd $(cat "../TOP_DIR"||echo $(dirname "$0"))/.. && pwd)
|
|
source "$TOP_DIR/config/paths"
|
|
source "$CONFIG_DIR/credentials"
|
|
source "$LIB_DIR/functions.guest.sh"
|
|
exec_logfile
|
|
|
|
indicate_current_auto
|
|
|
|
#------------------------------------------------------------------------------
|
|
# Create the provier (external) network and a subnet on it
|
|
# http://docs.openstack.org/newton/install-guide-ubuntu/launch-instance-networks-provider.html
|
|
#------------------------------------------------------------------------------
|
|
|
|
echo "Sourcing the admin credentials."
|
|
source "$CONFIG_DIR/admin-openstackrc.sh"
|
|
|
|
# Wait for neutron to start
|
|
wait_for_neutron
|
|
|
|
function wait_for_agent {
|
|
local agent=$1
|
|
|
|
echo -n "Waiting for neutron agent $agent."
|
|
(
|
|
source "$CONFIG_DIR/admin-openstackrc.sh"
|
|
while openstack network agent-list|grep "$agent"|grep "xxx" >/dev/null; do
|
|
sleep 1
|
|
echo -n .
|
|
done
|
|
echo
|
|
)
|
|
}
|
|
|
|
wait_for_agent neutron-l3-agent
|
|
|
|
echo "linuxbridge-agent and dhcp-agent must be up before we can add interfaces."
|
|
wait_for_agent neutron-linuxbridge-agent
|
|
wait_for_agent neutron-dhcp-agent
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Create the provider network
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
echo "Creating the public network."
|
|
openstack network create --share \
|
|
--provider-physical-network provider \
|
|
--provider-network-type flat provider
|
|
|
|
echo "Creating a subnet on the public network."
|
|
openstack subnet create --network provider \
|
|
--allocation-pool start="$START_IP_ADDRESS,end=$END_IP_ADDRESS" \
|
|
--dns-nameserver "$DNS_RESOLVER" --gateway "$PROVIDER_NETWORK_GATEWAY" \
|
|
--subnet-range "$PROVIDER_NETWORK_CIDR" provider
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Not in install-guide:
|
|
echo -n "Waiting for DHCP namespace."
|
|
until [ "$(ip netns | grep -c -o "^qdhcp-[a-z0-9-]*")" -gt 0 ]; do
|
|
sleep 1
|
|
echo -n .
|
|
done
|
|
echo
|
|
|
|
echo -n "Waiting for bridge to show up."
|
|
# Bridge names are something like brq219ddb93-c9
|
|
until [ "$(/sbin/brctl show | grep -c -o "^brq[a-z0-9-]*")" -gt 0 ]; do
|
|
sleep 1
|
|
echo -n .
|
|
done
|
|
echo
|
|
|
|
/sbin/brctl show
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|