Merge branch 'master' of github.com:open-cloud/xos
diff --git a/Dockerfile.cord b/Dockerfile.cord
new file mode 100644
index 0000000..2261628
--- /dev/null
+++ b/Dockerfile.cord
@@ -0,0 +1,5 @@
+FROM       xos:latest
+MAINTAINER Andy Bavier <acb@cs.princeton.edu>
+
+ADD xos/observers/vcpe/supervisor/vcpe-observer.conf /etc/supervisor/conf.d/
+RUN sed -i 's/ubuntu-vcpe4/trusty-server-multi-nic/' /opt/xos/cord/models.py
diff --git a/cloudlab-init.sh b/cloudlab-init.sh
index 446852f..4eeb071 100755
--- a/cloudlab-init.sh
+++ b/cloudlab-init.sh
@@ -1,30 +1,40 @@
 #!/bin/bash
 set -x
 
-# This script assumes that it is being run on the ctl node of the Tutorial-OpenStack
+# This script assumes that it is being run on the ctl node of the OpenStack
 # profile on CloudLab.
 
 XOS="http://ctl:9999/"
 AUTH="padmin@vicci.org:letmein"
+CORD=0
+IMAGE="xos"
 
 # Create public key if none present
-cat /dev/zero | ssh-keygen -q -N ""
-PUBKEY=$( cat ~/.ssh/id_rsa.pub )
-
-# Make sure the public key is available inside the container
-cp ~/.ssh/id_rsa.pub xos/observers/vcpe/vcpe_public_key
+[ -e ~/.ssh/id_rsa ] || cat /dev/zero | ssh-keygen -q -N ""
 
 # Install Docker
-wget -qO- https://get.docker.com/ | sh
+which docker > /dev/null || wget -qO- https://get.docker.com/ | sh
 sudo usermod -aG docker $(whoami)
 
 sudo apt-get install httpie
 
+if [ "$CORD" -ne 0 ]
+then
+    cp ~/.ssh/id_rsa.pub xos/observers/vcpe/vcpe_public_key
+    cp ~/.ssh/id_rsa     xos/observers/vcpe/vcpe_private_key
+fi
+
 sudo docker build -t xos .
 
+if [ "$CORD" -ne 0 ]
+then
+    sudo docker build -t cord -f Dockerfile.cord .
+    IMAGE="cord"
+fi
+
 # OpenStack is using port 8000...
 MYIP=$( hostname -i )
-sudo docker run -d --add-host="ctl:$MYIP" -p 9999:8000 xos
+sudo docker run -d --add-host="ctl:$MYIP" -p 9999:8000 $IMAGE
 
 echo "Waiting for XOS to come up"
 until http $XOS &> /dev/null
@@ -34,6 +44,7 @@
 
 # Copy public key
 # BUG: Shouldn't have to set the 'enacted' field...
+PUBKEY=$( cat ~/.ssh/id_rsa.pub )
 http --auth $AUTH PATCH $XOS/xos/users/1/ public_key="$PUBKEY" enacted=$( date "+%Y-%m-%dT%T")
 
 # Set up controller