Browse code

use CONTAINER_NAME instead of CONTAINER like build_kvm.sh

Jesse Andrews authored on 2011/10/23 12:52:29
Showing 2 changed files
... ...
@@ -27,7 +27,7 @@ CWD=`pwd`
27 27
 
28 28
 # Configurable params
29 29
 BRIDGE=${BRIDGE:-br0}
30
-CONTAINER=${CONTAINER:-STACK}
30
+CONTAINER_NAME=${CONTAINER_NAME:-STACK}
31 31
 CONTAINER_IP=${CONTAINER_IP:-192.168.1.50}
32 32
 CONTAINER_CIDR=${CONTAINER_CIDR:-$CONTAINER_IP/24}
33 33
 CONTAINER_NETMASK=${CONTAINER_NETMASK:-255.255.255.0}
... ...
@@ -60,7 +60,7 @@ if ! which cgdelete | grep -q cgdelete; then
60 60
 fi
61 61
 
62 62
 # Create lxc configuration
63
-LXC_CONF=/tmp/$CONTAINER.conf
63
+LXC_CONF=/tmp/$CONTAINER_NAME.conf
64 64
 cat > $LXC_CONF <<EOF
65 65
 lxc.network.type = veth
66 66
 lxc.network.link = $BRIDGE
... ...
@@ -71,11 +71,11 @@ lxc.cgroup.devices.allow = c 10:200 rwm
71 71
 EOF
72 72
 
73 73
 # Shutdown any existing container
74
-lxc-stop -n $CONTAINER
74
+lxc-stop -n $CONTAINER_NAME
75 75
 
76 76
 # This kills zombie containers
77
-if [ -d /cgroup/$CONTAINER ]; then
78
-    cgdelete -r cpu,net_cls:$CONTAINER
77
+if [ -d /cgroup/$CONTAINER_NAME ]; then
78
+    cgdelete -r cpu,net_cls:$CONTAINER_NAME
79 79
 fi
80 80
 
81 81
 # git clone only if directory doesn't exist already.  Since ``DEST`` might not
... ...
@@ -95,9 +95,9 @@ function git_clone {
95 95
 # Helper to create the container
96 96
 function create_lxc {
97 97
     if [ "natty" = "$UBUNTU_VERSION" ]; then
98
-        lxc-create -n $CONTAINER -t natty -f $LXC_CONF
98
+        lxc-create -n $CONTAINER_NAME -t natty -f $LXC_CONF
99 99
     else
100
-        lxc-create -n $CONTAINER -t ubuntu -f $LXC_CONF
100
+        lxc-create -n $CONTAINER_NAME -t ubuntu -f $LXC_CONF
101 101
     fi
102 102
 }
103 103
 
... ...
@@ -117,7 +117,7 @@ fi
117 117
 if [ ! -f $CACHEDIR/bootstrapped ]; then
118 118
     # by deleting the container, we force lxc-create to re-bootstrap (lxc is
119 119
     # lazy and doesn't do anything if a container already exists)
120
-    lxc-destroy -n $CONTAINER
120
+    lxc-destroy -n $CONTAINER_NAME
121 121
     # trigger the initial debootstrap
122 122
     create_lxc
123 123
     touch $CACHEDIR/bootstrapped
... ...
@@ -153,7 +153,7 @@ if [ "$USE_CURRENT_DEVSTACK" = "1" ]; then
153 153
 fi
154 154
 
155 155
 # Destroy the old container
156
-lxc-destroy -n $CONTAINER
156
+lxc-destroy -n $CONTAINER_NAME
157 157
 
158 158
 # If this call is to TERMINATE the container then exit
159 159
 if [ "$TERMINATE" = "1" ]; then
... ...
@@ -164,7 +164,7 @@ fi
164 164
 create_lxc
165 165
 
166 166
 # Specify where our container rootfs lives
167
-ROOTFS=/var/lib/lxc/$CONTAINER/rootfs/
167
+ROOTFS=/var/lib/lxc/$CONTAINER_NAME/rootfs/
168 168
 
169 169
 # Create a stack user that is a member of the libvirtd group so that stack
170 170
 # is able to interact with libvirt.
... ...
@@ -265,7 +265,7 @@ if ! mount | grep -q cgroup; then
265 265
 fi
266 266
 
267 267
 # Start our container
268
-lxc-start -d -n $CONTAINER
268
+lxc-start -d -n $CONTAINER_NAME
269 269
 
270 270
 if [ "$WAIT_TILL_LAUNCH" = "1" ]; then
271 271
     # Done creating the container, let's tail the log
... ...
@@ -18,7 +18,7 @@ COMMON_VARS="MYSQL_HOST=$HEAD_HOST RABBIT_HOST=$HEAD_HOST GLANCE_HOSTPORT=$HEAD_
18 18
 # Helper to launch containers
19 19
 function run_lxc {
20 20
     # For some reason container names with periods can cause issues :/
21
-    CONTAINER=$1 CONTAINER_IP=$2 CONTAINER_NETMASK=$NETMASK CONTAINER_GATEWAY=$GATEWAY NAMESERVER=$NAMESERVER TERMINATE=$TERMINATE STACKSH_PARAMS="$COMMON_VARS $3" ./build_lxc.sh
21
+    CONTAINER_NAME=$1 CONTAINER_IP=$2 CONTAINER_NETMASK=$NETMASK CONTAINER_GATEWAY=$GATEWAY NAMESERVER=$NAMESERVER TERMINATE=$TERMINATE STACKSH_PARAMS="$COMMON_VARS $3" ./build_lxc.sh
22 22
 }
23 23
 
24 24
 # Launch the head node - headnode uses a non-ip domain name,