update comments and added check for double mount bug
| ... | ... |
@@ -30,18 +30,19 @@ if ! grep -q natty /etc/lsb-release; then |
| 30 | 30 |
fi |
| 31 | 31 |
fi |
| 32 | 32 |
|
| 33 |
+# Keep track of the current devstack directory. |
|
| 34 |
+TOP_DIR=$(cd $(dirname "$0") && pwd) |
|
| 35 |
+ |
|
| 33 | 36 |
# stack.sh keeps the list of **apt** and **pip** dependencies in external |
| 34 | 37 |
# files, along with config templates and other useful files. You can find these |
| 35 | 38 |
# in the ``files`` directory (next to this script). We will reference this |
| 36 | 39 |
# directory using the ``FILES`` variable in this script. |
| 37 |
-FILES=`pwd`/files |
|
| 40 |
+FILES=$TOP_DIR/files |
|
| 38 | 41 |
if [ ! -d $FILES ]; then |
| 39 | 42 |
echo "ERROR: missing devstack/files - did you grab more than just stack.sh?" |
| 40 | 43 |
exit 1 |
| 41 | 44 |
fi |
| 42 | 45 |
|
| 43 |
-# Keep track of the current devstack directory. |
|
| 44 |
-TOP_DIR=$(cd $(dirname "$0") && pwd) |
|
| 45 | 46 |
|
| 46 | 47 |
# OpenStack is designed to be run as a regular user (Dashboard will fail to run |
| 47 | 48 |
# as root, since apache refused to startup serve content from root user). If |
| ... | ... |
@@ -292,6 +293,8 @@ sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install `cat $FILES/pips/*` |
| 292 | 292 |
function git_clone {
|
| 293 | 293 |
# if there is an existing checkout, move it out of the way |
| 294 | 294 |
if [[ "$RECLONE" == "yes" ]]; then |
| 295 |
+ # FIXME(ja): if we were smarter we could speed up RECLONE by |
|
| 296 |
+ # using the old git repo as the basis of our new clone... |
|
| 295 | 297 |
if [ -d $2 ]; then |
| 296 | 298 |
mv $2 /tmp/stack.`date +%s` |
| 297 | 299 |
fi |
| ... | ... |
@@ -408,6 +411,8 @@ if [[ "$ENABLED_SERVICES" =~ "dash" ]]; then |
| 408 | 408 |
# ``local_settings.py`` is used to override dashboard default settings. |
| 409 | 409 |
cp $FILES/dash_settings.py $DASH_DIR/openstack-dashboard/local/local_settings.py |
| 410 | 410 |
|
| 411 |
+ # Initialize the dashboard database (it stores sessions and notices shown to |
|
| 412 |
+ # users). The user system is external (keystone). |
|
| 411 | 413 |
cd $DASH_DIR/openstack-dashboard |
| 412 | 414 |
dashboard/manage.py syncdb |
| 413 | 415 |
|
| ... | ... |
@@ -435,7 +440,8 @@ if [[ "$ENABLED_SERVICES" =~ "g-reg" ]]; then |
| 435 | 435 |
# (re)create glance database |
| 436 | 436 |
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS glance;' |
| 437 | 437 |
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE glance;' |
| 438 |
- # Copy over our glance-registry.conf |
|
| 438 |
+ |
|
| 439 |
+ # Copy over our glance configurations and update them |
|
| 439 | 440 |
GLANCE_CONF=$GLANCE_DIR/etc/glance-registry.conf |
| 440 | 441 |
cp $FILES/glance-registry.conf $GLANCE_CONF |
| 441 | 442 |
sudo sed -e "s,%SQL_CONN%,$BASE_SQL_CONN/glance,g" -i $GLANCE_CONF |
| ... | ... |
@@ -454,7 +460,7 @@ fi |
| 454 | 454 |
# We are going to use the sample http middleware configuration from the keystone |
| 455 | 455 |
# project to launch nova. This paste config adds the configuration required |
| 456 | 456 |
# for nova to validate keystone tokens - except we need to switch the config |
| 457 |
-# to use our admin token instead (instead of the token from their sample data). |
|
| 457 |
+# to use our service token instead (instead of the invalid token 999888777666). |
|
| 458 | 458 |
sudo sed -e "s,999888777666,$SERVICE_TOKEN,g" -i $KEYSTONE_DIR/examples/paste/nova-api-paste.ini |
| 459 | 459 |
|
| 460 | 460 |
if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then |
| ... | ... |
@@ -465,9 +471,9 @@ if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then |
| 465 | 465 |
# attempt to load modules: network block device - used to manage qcow images |
| 466 | 466 |
sudo modprobe nbd || true |
| 467 | 467 |
|
| 468 |
- # Check for kvm (hardware based virtualization). If unable to load kvm, |
|
| 469 |
- # set the libvirt type to qemu. Note: many systems come with hardware |
|
| 470 |
- # virtualization disabled in BIOS. |
|
| 468 |
+ # Check for kvm (hardware based virtualization). If unable to initialize |
|
| 469 |
+ # kvm, we drop back to the slower emulation mode (qemu). Note: many systems |
|
| 470 |
+ # come with hardware virtualization disabled in BIOS. |
|
| 471 | 471 |
if [[ "$LIBVIRT_TYPE" == "kvm" ]]; then |
| 472 | 472 |
sudo modprobe kvm || true |
| 473 | 473 |
if [ ! -e /dev/kvm ]; then |
| ... | ... |
@@ -481,7 +487,8 @@ if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then |
| 481 | 481 |
# to simulate multiple systems. |
| 482 | 482 |
if [[ "$LIBVIRT_TYPE" == "lxc" ]]; then |
| 483 | 483 |
sudo apt-get install lxc -y |
| 484 |
- # lxc requires cgroups to be configured on /cgroup |
|
| 484 |
+ # lxc uses cgroups (a kernel interface via virtual filesystem) configured |
|
| 485 |
+ # and mounted to ``/cgroup`` |
|
| 485 | 486 |
sudo mkdir -p /cgroup |
| 486 | 487 |
if ! grep -q cgroup /etc/fstab; then |
| 487 | 488 |
echo none /cgroup cgroup cpuacct,memory,devices,cpu,freezer,blkio 0 0 | sudo tee -a /etc/fstab |
| ... | ... |
@@ -491,9 +498,12 @@ if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then |
| 491 | 491 |
fi |
| 492 | 492 |
fi |
| 493 | 493 |
|
| 494 |
- # User needs to be member of libvirtd group for nova-compute to use libvirt. |
|
| 494 |
+ # The user that nova runs as needs to be member of libvirtd group otherwise |
|
| 495 |
+ # nova-compute will be unable to use libvirt. |
|
| 495 | 496 |
sudo usermod -a -G libvirtd `whoami` |
| 496 |
- # if kvm wasn't running before we need to restart libvirt to enable it |
|
| 497 |
+ # libvirt detects various settings on startup, as we potentially changed |
|
| 498 |
+ # the system configuration (modules, filesystems), we need to restart |
|
| 499 |
+ # libvirt to detect those changes. |
|
| 497 | 500 |
sudo /etc/init.d/libvirt-bin restart |
| 498 | 501 |
|
| 499 | 502 |
|
| ... | ... |
@@ -503,12 +513,14 @@ if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then |
| 503 | 503 |
# Nova stores each instance in its own directory. |
| 504 | 504 |
mkdir -p $NOVA_DIR/instances |
| 505 | 505 |
|
| 506 |
- # if there is a partition labeled nova-instances use it (ext filesystems |
|
| 507 |
- # can be labeled via e2label) |
|
| 508 |
- ## FIXME: if already mounted this blows up... |
|
| 506 |
+ # You can specify a different disk to be mounted and used for backing the |
|
| 507 |
+ # virtual machines. If there is a partition labeled nova-instances we |
|
| 508 |
+ # mount it (ext filesystems can be labeled via e2label). |
|
| 509 | 509 |
if [ -L /dev/disk/by-label/nova-instances ]; then |
| 510 |
- sudo mount -L nova-instances $NOVA_DIR/instances |
|
| 511 |
- sudo chown -R `whoami` $NOVA_DIR/instances |
|
| 510 |
+ if ! mount -n | grep -q nova-instances; then |
|
| 511 |
+ sudo mount -L nova-instances $NOVA_DIR/instances |
|
| 512 |
+ sudo chown -R `whoami` $NOVA_DIR/instances |
|
| 513 |
+ fi |
|
| 512 | 514 |
fi |
| 513 | 515 |
|
| 514 | 516 |
# Clean out the instances directory. |