floating ip support, and cleanup functionality
This commit is contained in:
parent
1c9f0afeb3
commit
23761c3553
2 changed files with 19 additions and 7 deletions
|
@ -69,6 +69,11 @@ fi
|
||||||
# Destroy the old container
|
# Destroy the old container
|
||||||
lxc-destroy -n $CONTAINER
|
lxc-destroy -n $CONTAINER
|
||||||
|
|
||||||
|
# If this call is to TERMINATE the container then exit
|
||||||
|
if [ "$TERMINATE" = "1" ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
# Create the container
|
# Create the container
|
||||||
lxc-create -n $CONTAINER -t natty -f $LXC_CONF
|
lxc-create -n $CONTAINER -t natty -f $LXC_CONF
|
||||||
|
|
||||||
|
|
|
@ -4,16 +4,21 @@ HEAD_HOST=${HEAD_HOST:-192.168.1.52}
|
||||||
COMPUTE_HOSTS=${COMPUTE_HOSTS:-192.168.1.53,192.168.1.54}
|
COMPUTE_HOSTS=${COMPUTE_HOSTS:-192.168.1.53,192.168.1.54}
|
||||||
|
|
||||||
# Networking params
|
# Networking params
|
||||||
NAMESERVER=${NAMESERVER:-192.168.2.1}
|
NAMESERVER=${NAMESERVER:-192.168.1.1}
|
||||||
GATEWAY=${GATEWAY:-192.168.1.1}
|
GATEWAY=${GATEWAY:-192.168.1.1}
|
||||||
|
NETMASK=${NETMASK:-255.255.255.0}
|
||||||
|
FLOATING_RANGE=${FLOATING_RANGE:-192.168.1.196/30}
|
||||||
|
|
||||||
|
# Setting this to 1 shuts down and destroys our containers without relaunching.
|
||||||
|
TERMINATE=${TERMINATE:-0}
|
||||||
|
|
||||||
# Variables common amongst all hosts in the cluster
|
# Variables common amongst all hosts in the cluster
|
||||||
COMMON_VARS="MYSQL_HOST=$HEAD_HOST RABBIT_HOST=$HEAD_HOST GLANCE_HOSTPORT=$HEAD_HOST:9292 NET_MAN=FlatDHCPManager FLAT_INTERFACE=eth0"
|
COMMON_VARS="MYSQL_HOST=$HEAD_HOST RABBIT_HOST=$HEAD_HOST GLANCE_HOSTPORT=$HEAD_HOST:9292 NET_MAN=FlatDHCPManager FLAT_INTERFACE=eth0 FLOATING_RANGE=$FLOATING_RANGE MULTI_HOST=1"
|
||||||
|
|
||||||
# Helper to launch containers
|
# Helper to launch containers
|
||||||
function run_lxc {
|
function run_lxc {
|
||||||
# For some reason container names with periods can cause issues :/
|
# For some reason container names with periods can cause issues :/
|
||||||
CONTAINER=$1 CONTAINER_IP=$2 CONTAINER_GATEWAY=$GATEWAY NAMESERVER=$NAMESERVER STACKSH_PARAMS="$COMMON_VARS $3" ./build_lxc.sh
|
CONTAINER=$1 CONTAINER_IP=$2 CONTAINER_NETMASK=$NETMASK CONTAINER_GATEWAY=$GATEWAY NAMESERVER=$NAMESERVER TERMINATE=$TERMINATE STACKSH_PARAMS="$COMMON_VARS $3" ./build_lxc.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
# Launch the head node - headnode uses a non-ip domain name,
|
# Launch the head node - headnode uses a non-ip domain name,
|
||||||
|
@ -21,10 +26,12 @@ function run_lxc {
|
||||||
run_lxc STACKMASTER $HEAD_HOST "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vnc,dash,mysql,rabbit"
|
run_lxc STACKMASTER $HEAD_HOST "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vnc,dash,mysql,rabbit"
|
||||||
|
|
||||||
# Wait till the head node is up
|
# Wait till the head node is up
|
||||||
while ! wget -q -O- http://$HEAD_HOST | grep -q username; do
|
if [ ! "$TERMINATE" = "1" ]; then
|
||||||
|
while ! wget -q -O- http://$HEAD_HOST | grep -q username; do
|
||||||
echo "Waiting for head node ($HEAD_HOST) to start..."
|
echo "Waiting for head node ($HEAD_HOST) to start..."
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Launch the compute hosts
|
# Launch the compute hosts
|
||||||
for compute_host in ${COMPUTE_HOSTS//,/ }; do
|
for compute_host in ${COMPUTE_HOSTS//,/ }; do
|
||||||
|
|
Loading…
Reference in a new issue