use CONTAINER_NAME instead of CONTAINER like build_kvm.sh

This commit is contained in:
Jesse Andrews 2011-10-22 20:52:29 -07:00
parent ec1d0318ab
commit ccc11c9d18
2 changed files with 12 additions and 12 deletions

View file

@ -27,7 +27,7 @@ CWD=`pwd`
# Configurable params # Configurable params
BRIDGE=${BRIDGE:-br0} BRIDGE=${BRIDGE:-br0}
CONTAINER=${CONTAINER:-STACK} CONTAINER_NAME=${CONTAINER_NAME:-STACK}
CONTAINER_IP=${CONTAINER_IP:-192.168.1.50} CONTAINER_IP=${CONTAINER_IP:-192.168.1.50}
CONTAINER_CIDR=${CONTAINER_CIDR:-$CONTAINER_IP/24} CONTAINER_CIDR=${CONTAINER_CIDR:-$CONTAINER_IP/24}
CONTAINER_NETMASK=${CONTAINER_NETMASK:-255.255.255.0} CONTAINER_NETMASK=${CONTAINER_NETMASK:-255.255.255.0}
@ -60,7 +60,7 @@ if ! which cgdelete | grep -q cgdelete; then
fi fi
# Create lxc configuration # Create lxc configuration
LXC_CONF=/tmp/$CONTAINER.conf LXC_CONF=/tmp/$CONTAINER_NAME.conf
cat > $LXC_CONF <<EOF cat > $LXC_CONF <<EOF
lxc.network.type = veth lxc.network.type = veth
lxc.network.link = $BRIDGE lxc.network.link = $BRIDGE
@ -71,11 +71,11 @@ lxc.cgroup.devices.allow = c 10:200 rwm
EOF EOF
# Shutdown any existing container # Shutdown any existing container
lxc-stop -n $CONTAINER lxc-stop -n $CONTAINER_NAME
# This kills zombie containers # This kills zombie containers
if [ -d /cgroup/$CONTAINER ]; then if [ -d /cgroup/$CONTAINER_NAME ]; then
cgdelete -r cpu,net_cls:$CONTAINER cgdelete -r cpu,net_cls:$CONTAINER_NAME
fi fi
# git clone only if directory doesn't exist already. Since ``DEST`` might not # git clone only if directory doesn't exist already. Since ``DEST`` might not
@ -95,9 +95,9 @@ function git_clone {
# Helper to create the container # Helper to create the container
function create_lxc { function create_lxc {
if [ "natty" = "$UBUNTU_VERSION" ]; then if [ "natty" = "$UBUNTU_VERSION" ]; then
lxc-create -n $CONTAINER -t natty -f $LXC_CONF lxc-create -n $CONTAINER_NAME -t natty -f $LXC_CONF
else else
lxc-create -n $CONTAINER -t ubuntu -f $LXC_CONF lxc-create -n $CONTAINER_NAME -t ubuntu -f $LXC_CONF
fi fi
} }
@ -117,7 +117,7 @@ fi
if [ ! -f $CACHEDIR/bootstrapped ]; then if [ ! -f $CACHEDIR/bootstrapped ]; then
# by deleting the container, we force lxc-create to re-bootstrap (lxc is # by deleting the container, we force lxc-create to re-bootstrap (lxc is
# lazy and doesn't do anything if a container already exists) # lazy and doesn't do anything if a container already exists)
lxc-destroy -n $CONTAINER lxc-destroy -n $CONTAINER_NAME
# trigger the initial debootstrap # trigger the initial debootstrap
create_lxc create_lxc
touch $CACHEDIR/bootstrapped touch $CACHEDIR/bootstrapped
@ -153,7 +153,7 @@ if [ "$USE_CURRENT_DEVSTACK" = "1" ]; then
fi fi
# Destroy the old container # Destroy the old container
lxc-destroy -n $CONTAINER lxc-destroy -n $CONTAINER_NAME
# If this call is to TERMINATE the container then exit # If this call is to TERMINATE the container then exit
if [ "$TERMINATE" = "1" ]; then if [ "$TERMINATE" = "1" ]; then
@ -164,7 +164,7 @@ fi
create_lxc create_lxc
# Specify where our container rootfs lives # Specify where our container rootfs lives
ROOTFS=/var/lib/lxc/$CONTAINER/rootfs/ ROOTFS=/var/lib/lxc/$CONTAINER_NAME/rootfs/
# Create a stack user that is a member of the libvirtd group so that stack # Create a stack user that is a member of the libvirtd group so that stack
# is able to interact with libvirt. # is able to interact with libvirt.
@ -265,7 +265,7 @@ if ! mount | grep -q cgroup; then
fi fi
# Start our container # Start our container
lxc-start -d -n $CONTAINER lxc-start -d -n $CONTAINER_NAME
if [ "$WAIT_TILL_LAUNCH" = "1" ]; then if [ "$WAIT_TILL_LAUNCH" = "1" ]; then
# Done creating the container, let's tail the log # Done creating the container, let's tail the log

View file

@ -18,7 +18,7 @@ COMMON_VARS="MYSQL_HOST=$HEAD_HOST RABBIT_HOST=$HEAD_HOST GLANCE_HOSTPORT=$HEAD_
# 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_NETMASK=$NETMASK CONTAINER_GATEWAY=$GATEWAY NAMESERVER=$NAMESERVER TERMINATE=$TERMINATE STACKSH_PARAMS="$COMMON_VARS $3" ./build_lxc.sh CONTAINER_NAME=$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,