Browse code

Cosmetic, comment and text cleanups

* functions
* stack.sh
* stackrc
* unstack.sh

A recent commit to stack.sh broke the RST formatting done by shocco to
produce the HTML-formatted files on devstack.org. A bunch of comment
and spacing fixes were done (ala pep8 if there were such a thing for
shell scripts).

The only non-comment changes made were to the content of some error
messages.

Fixes bug 1042271

Change-Id: Id1c74cf25c03c4f18ed741f8026e36b0d4a598dd

Dean Troyer authored on 2012/08/29 07:43:40
Showing 4 changed files
... ...
@@ -1,7 +1,16 @@
1
-# -*- mode: Shell-script -*-
2 1
 # functions - Common functions used by DevStack components
3 2
 #
4
-# ENABLED_SERVICES is used by is_service_enabled()
3
+# The following variables are assumed to be defined by certain functions:
4
+# ``DISTRO``
5
+# ``ENABLED_SERVICES``
6
+# ``EROR_ON_CLONE``
7
+# ``FILES``
8
+# ``GLANCE_HOSTPORT``
9
+# ``OFFLINE``
10
+# ``PIP_DOWNLOAD_CACHE``
11
+# ``RECLONE``
12
+# ``TRACK_DEPENDS``
13
+# ``http_proxy``, ``https_proxy``, ``no_proxy``
5 14
 
6 15
 
7 16
 # Save trace setting
... ...
@@ -9,9 +18,9 @@ XTRACE=$(set +o | grep xtrace)
9 9
 set +o xtrace
10 10
 
11 11
 
12
-# Exit 0 if address is in network or 1 if
13
-# address is not in network or netaddr library
14
-# is not installed.
12
+# Exit 0 if address is in network or 1 if address is not in
13
+# network or netaddr library is not installed.
14
+# address_in_net ip-address ip-range
15 15
 function address_in_net() {
16 16
     python -c "
17 17
 import netaddr
... ...
@@ -21,7 +30,8 @@ sys.exit(netaddr.IPAddress('$1') not in netaddr.IPNetwork('$2'))
21 21
 }
22 22
 
23 23
 
24
-# apt-get wrapper to set arguments correctly
24
+# Wrapper for ``apt-get`` to set cache and proxy environment variables
25
+# Uses globals ``OFFLINE``, ``*_proxy`
25 26
 # apt_get operation package [package ...]
26 27
 function apt_get() {
27 28
     [[ "$OFFLINE" = "True" || -z "$@" ]] && return
... ...
@@ -88,15 +98,16 @@ function get_field() {
88 88
 
89 89
 
90 90
 # get_packages() collects a list of package names of any type from the
91
-# prerequisite files in ``files/{apts|pips}``.  The list is intended
92
-# to be passed to a package installer such as apt or pip.
91
+# prerequisite files in ``files/{apts|rpms}``.  The list is intended
92
+# to be passed to a package installer such as apt or yum.
93 93
 #
94
-# Only packages required for the services in ENABLED_SERVICES will be
94
+# Only packages required for the services in ``ENABLED_SERVICES`` will be
95 95
 # included.  Two bits of metadata are recognized in the prerequisite files:
96 96
 # - ``# NOPRIME`` defers installation to be performed later in stack.sh
97 97
 # - ``# dist:DISTRO`` or ``dist:DISTRO1,DISTRO2`` limits the selection
98 98
 #   of the package to the distros listed.  The distro names are case insensitive.
99 99
 #
100
+# Uses globals ``DISTRO``, ``ENABLED_SERVICES``
100 101
 # get_packages dir
101 102
 function get_packages() {
102 103
     local package_dir=$1
... ...
@@ -241,6 +252,7 @@ GetOSVersion() {
241 241
 }
242 242
 
243 243
 # git update using reference as a branch.
244
+# git_update_branch ref
244 245
 function git_update_branch() {
245 246
 
246 247
     GIT_BRANCH=$1
... ...
@@ -254,6 +266,7 @@ function git_update_branch() {
254 254
 
255 255
 # git update using reference as a tag. Be careful editing source at that repo
256 256
 # as working copy will be in a detached mode
257
+# git_update_tag ref
257 258
 function git_update_tag() {
258 259
 
259 260
     GIT_TAG=$1
... ...
@@ -289,6 +302,7 @@ function GetDistro() {
289 289
 # Set global RECLONE=yes to simulate a clone when dest-dir exists
290 290
 # Set global ERROR_ON_CLONE=True to abort execution with an error if the git repo
291 291
 # does not exist (default is False, meaning the repo will be cloned).
292
+# Uses global ``OFFLINE``
292 293
 # git_clone remote dest-dir branch
293 294
 function git_clone {
294 295
     [[ "$OFFLINE" = "True" ]] && return
... ...
@@ -394,16 +408,20 @@ $option = $value
394 394
 
395 395
 
396 396
 # is_service_enabled() checks if the service(s) specified as arguments are
397
-# enabled by the user in **ENABLED_SERVICES**.
397
+# enabled by the user in ``ENABLED_SERVICES``.
398 398
 #
399
-# If there are multiple services specified as arguments the test performs a
400
-# boolean OR or if any of the services specified on the command line
401
-# return true.
399
+# Multiple services specified as arguments are ``OR``'ed together; the test
400
+# is a short-circuit boolean, i.e it returns on the first match.
402 401
 #
403
-# There is a special cases for some 'catch-all' services::
402
+# There are special cases for some 'catch-all' services::
404 403
 #   **nova** returns true if any service enabled start with **n-**
404
+#   **cinder** returns true if any service enabled start with **c-**
405
+#   **ceilometer** returns true if any service enabled start with **ceilometer**
405 406
 #   **glance** returns true if any service enabled start with **g-**
406 407
 #   **quantum** returns true if any service enabled start with **q-**
408
+#
409
+# Uses global ``ENABLED_SERVICES``
410
+# is_service_enabled service [service ...]
407 411
 function is_service_enabled() {
408 412
     services=$@
409 413
     for service in ${services}; do
... ...
@@ -417,7 +435,9 @@ function is_service_enabled() {
417 417
     return 1
418 418
 }
419 419
 
420
-# remove extra commas from the input string (ENABLED_SERVICES)
420
+
421
+# remove extra commas from the input string (i.e. ``ENABLED_SERVICES``)
422
+# _cleanup_service_list service-list
421 423
 function _cleanup_service_list () {
422 424
     echo "$1" | sed -e '
423 425
         s/,,/,/g;
... ...
@@ -426,15 +446,17 @@ function _cleanup_service_list () {
426 426
     '
427 427
 }
428 428
 
429
+
429 430
 # enable_service() adds the services passed as argument to the
430
-# **ENABLED_SERVICES** list, if they are not already present.
431
+# ``ENABLED_SERVICES`` list, if they are not already present.
431 432
 #
432 433
 # For example:
433
-#
434 434
 #   enable_service n-vol
435 435
 #
436 436
 # This function does not know about the special cases
437 437
 # for nova, glance, and quantum built into is_service_enabled().
438
+# Uses global ``ENABLED_SERVICES``
439
+# enable_service service [service ...]
438 440
 function enable_service() {
439 441
     local tmpsvcs="${ENABLED_SERVICES}"
440 442
     for service in $@; do
... ...
@@ -446,15 +468,17 @@ function enable_service() {
446 446
     disable_negated_services
447 447
 }
448 448
 
449
+
449 450
 # disable_service() removes the services passed as argument to the
450
-# **ENABLED_SERVICES** list, if they are present.
451
+# ``ENABLED_SERVICES`` list, if they are present.
451 452
 #
452 453
 # For example:
453
-#
454 454
 #   disable_service n-vol
455 455
 #
456 456
 # This function does not know about the special cases
457 457
 # for nova, glance, and quantum built into is_service_enabled().
458
+# Uses global ``ENABLED_SERVICES``
459
+# disable_service service [service ...]
458 460
 function disable_service() {
459 461
     local tmpsvcs=",${ENABLED_SERVICES},"
460 462
     local service
... ...
@@ -466,17 +490,22 @@ function disable_service() {
466 466
     ENABLED_SERVICES=$(_cleanup_service_list "$tmpsvcs")
467 467
 }
468 468
 
469
+
469 470
 # disable_all_services() removes all current services
470
-# from **ENABLED_SERVICES** to reset the configuration
471
+# from ``ENABLED_SERVICES`` to reset the configuration
471 472
 # before a minimal installation
473
+# Uses global ``ENABLED_SERVICES``
474
+# disable_all_services
472 475
 function disable_all_services() {
473 476
     ENABLED_SERVICES=""
474 477
 }
475 478
 
476
-# We are looking for services with a - at the beginning to force
477
-# excluding those services. For example if you want to install all the default
478
-# services but not nova-volume (n-vol) you can have this set in your localrc :
479
+
480
+# Remove all services starting with '-'.  For example, to install all default
481
+# services except nova-volume (n-vol) set in ``localrc``:
479 482
 # ENABLED_SERVICES+=",-n-vol"
483
+# Uses global ``ENABLED_SERVICES``
484
+# disable_negated_services
480 485
 function disable_negated_services() {
481 486
     local tmpsvcs="${ENABLED_SERVICES}"
482 487
     local service
... ...
@@ -488,6 +517,7 @@ function disable_negated_services() {
488 488
     ENABLED_SERVICES=$(_cleanup_service_list "$tmpsvcs")
489 489
 }
490 490
 
491
+
491 492
 # Distro-agnostic package installer
492 493
 # install_package package [package ...]
493 494
 function install_package() {
... ...
@@ -513,7 +543,8 @@ function is_set() {
513 513
 }
514 514
 
515 515
 
516
-# pip install wrapper to set cache and proxy environment variables
516
+# Wrapper for ``pip install`` to set cache and proxy environment variables
517
+# Uses globals ``OFFLINE``, ``PIP_DOWNLOAD_CACHE``, ``TRACK_DEPENDES``, ``*_proxy`
517 518
 # pip_install package [package ...]
518 519
 function pip_install {
519 520
     [[ "$OFFLINE" = "True" || -z "$@" ]] && return
... ...
@@ -554,8 +585,9 @@ function restart_service() {
554 554
 }
555 555
 
556 556
 
557
-# pip install the dependencies of the package before we do the setup.py
558
-# develop, so that pip and not distutils process the dependency chain
557
+# ``pip install`` the dependencies of the package before ``setup.py develop``
558
+# so pip and not distutils processes the dependency chain
559
+# Uses globals ``TRACK_DEPENDES``, ``*_proxy`
559 560
 # setup_develop directory
560 561
 function setup_develop() {
561 562
     if [[ $TRACK_DEPENDS = True ]] ; then
... ...
@@ -606,7 +638,9 @@ function stop_service() {
606 606
 
607 607
 
608 608
 # Normalize config values to True or False
609
-# VAR=`trueorfalse default-value test-value`
609
+# Accepts as False: 0 no false False FALSE
610
+# Accepts as True: 1 yes true True TRUE
611
+# VAR=$(trueorfalse default-value test-value)
610 612
 function trueorfalse() {
611 613
     local default=$1
612 614
     local testval=$2
... ...
@@ -620,8 +654,8 @@ function trueorfalse() {
620 620
 
621 621
 # Retrieve an image from a URL and upload into Glance
622 622
 # Uses the following variables:
623
-#   **FILES** must be set to the cache dir
624
-#   **GLANCE_HOSTPORT**
623
+#   ``FILES`` must be set to the cache dir
624
+#   ``GLANCE_HOSTPORT``
625 625
 # upload_image image-url glance-token
626 626
 function upload_image() {
627 627
     local image_url=$1
... ...
@@ -717,7 +751,8 @@ function upload_image() {
717 717
 }
718 718
 
719 719
 
720
-# yum wrapper to set arguments correctly
720
+# Wrapper for ``yum`` to set proxy environment variables
721
+# Uses globals ``OFFLINE``, ``*_proxy`
721 722
 # yum_install package [package ...]
722 723
 function yum_install() {
723 724
     [[ "$OFFLINE" = "True" ]] && return
... ...
@@ -731,3 +766,8 @@ function yum_install() {
731 731
 
732 732
 # Restore xtrace
733 733
 $XTRACE
734
+
735
+
736
+# Local variables:
737
+# -*- mode: Shell-script -*-
738
+# End:
734 739
\ No newline at end of file
... ...
@@ -1,8 +1,9 @@
1 1
 #!/usr/bin/env bash
2 2
 
3 3
 # ``stack.sh`` is an opinionated OpenStack developer installation.  It
4
-# installs and configures various combinations of **Glance**, **Horizon**,
5
-# **Keystone**, **Nova**, **Quantum**, **Heat** and **Swift**
4
+# installs and configures various combinations of **Ceilometer**, **Cinder**,
5
+# **Glance**, **Heat**, **Horizon**, **Keystone**, **Nova**, **Quantum**
6
+# and **Swift**
6 7
 
7 8
 # This script allows you to specify configuration options of what git
8 9
 # repositories to use, enabled services, network configuration and various
... ...
@@ -10,14 +11,14 @@
10 10
 # shared settings for common resources (mysql, rabbitmq) and build a multi-node
11 11
 # developer install.
12 12
 
13
-# To keep this script simple we assume you are running on an **Ubuntu 11.10
14
-# Oneiric** or **Ubuntu 12.04 Precise** machine.  It should work in a VM or
15
-# physical server.  Additionally we put the list of ``apt`` and ``pip``
16
-# dependencies and other configuration files in this repo.  So start by
17
-# grabbing this script and the dependencies.
13
+# To keep this script simple we assume you are running on a recent **Ubuntu**
14
+# (11.10 Oneiric or 12.04 Precise) or **Fedora** (F16 or F17) machine.  It
15
+# should work in a VM or physical server.  Additionally we put the list of
16
+# ``apt`` and ``rpm`` dependencies and other configuration files in this repo.
18 17
 
19 18
 # Learn more and get the most recent version at http://devstack.org
20 19
 
20
+
21 21
 # Keep track of the devstack directory
22 22
 TOP_DIR=$(cd $(dirname "$0") && pwd)
23 23
 
... ...
@@ -47,25 +48,31 @@ GetDistro
47 47
 #     MYSQL_USER=hellaroot
48 48
 #
49 49
 # We try to have sensible defaults, so you should be able to run ``./stack.sh``
50
-# in most cases.
50
+# in most cases.  ``localrc`` is not distributed with DevStack and will never
51
+# be overwritten by a DevStack update.
51 52
 #
52 53
 # DevStack distributes ``stackrc`` which contains locations for the OpenStack
53 54
 # repositories and branches to configure.  ``stackrc`` sources ``localrc`` to
54
-# allow you to safely override those settings without being overwritten
55
-# when updating DevStack.
55
+# allow you to safely override those settings.
56
+
56 57
 if [[ ! -r $TOP_DIR/stackrc ]]; then
57 58
     echo "ERROR: missing $TOP_DIR/stackrc - did you grab more than just stack.sh?"
58 59
     exit 1
59 60
 fi
60 61
 source $TOP_DIR/stackrc
61 62
 
62
-# HTTP and HTTPS proxy servers are supported via the usual environment variables
63
-# ``http_proxy`` and ``https_proxy``.  Additionally if you would like to access
64
-# to specific server directly and not through the proxy server, you can use
65
-# ``no_proxy`` environment variable.  They can be set in ``localrc`` if necessary
66
-# or on the command line::
63
+
64
+# Proxy Settings
65
+# --------------
66
+
67
+# HTTP and HTTPS proxy servers are supported via the usual environment variables [1]
68
+# ``http_proxy``, ``https_proxy`` and ``no_proxy``. They can be set in
69
+# ``localrc`` if necessary or on the command line::
70
+#
71
+# [1] http://www.w3.org/Daemon/User/Proxies/ProxyClients.html
67 72
 #
68 73
 #     http_proxy=http://proxy.example.com:3128/ no_proxy=repo.example.net ./stack.sh
74
+
69 75
 if [[ -n "$http_proxy" ]]; then
70 76
     export http_proxy=$http_proxy
71 77
 fi
... ...
@@ -98,6 +105,7 @@ if [[ ! ${DISTRO} =~ (oneiric|precise|quantal|f16|f17) ]]; then
98 98
     fi
99 99
 fi
100 100
 
101
+# Disallow qpid on oneiric
101 102
 if [ "${DISTRO}" = "oneiric" ] && is_service_enabled qpid ; then
102 103
     # Qpid was introduced in precise
103 104
     echo "You must use Ubuntu Precise or newer for Qpid support."
... ...
@@ -114,17 +122,15 @@ fi
114 114
 # ``stack.sh`` keeps function libraries here
115 115
 # Make sure ``$TOP_DIR/lib`` directory is present
116 116
 if [ ! -d $TOP_DIR/lib ]; then
117
-    echo "ERROR: missing devstack/lib - did you grab more than just stack.sh?"
117
+    echo "ERROR: missing devstack/lib"
118 118
     exit 1
119 119
 fi
120 120
 
121
-# stack.sh keeps the list of ``apt`` and ``pip`` dependencies in external
122
-# files, along with config templates and other useful files.  You can find these
123
-# in the ``files`` directory (next to this script).  We will reference this
124
-# directory using the ``FILES`` variable in this script.
121
+# ``stack.sh`` keeps the list of ``apt`` and ``rpm`` dependencies and config
122
+# templates and other useful files in the ``files`` subdirectory
125 123
 FILES=$TOP_DIR/files
126 124
 if [ ! -d $FILES ]; then
127
-    echo "ERROR: missing devstack/files - did you grab more than just stack.sh?"
125
+    echo "ERROR: missing devstack/files"
128 126
     exit 1
129 127
 fi
130 128
 
... ...
@@ -132,7 +138,7 @@ fi
132 132
 if type -p screen >/dev/null && screen -ls | egrep -q "[0-9].stack"; then
133 133
     echo "You are already running a stack.sh session."
134 134
     echo "To rejoin this session type 'screen -x stack'."
135
-    echo "To destroy this session, kill the running screen."
135
+    echo "To destroy this session, type './unstack.sh'."
136 136
     exit 1
137 137
 fi
138 138
 
... ...
@@ -142,8 +148,12 @@ if is_service_enabled cinder && is_service_enabled n-vol; then
142 142
     exit 1
143 143
 fi
144 144
 
145
-# OpenStack is designed to be run as a regular user (Horizon will fail to run
146
-# as root, since apache refused to startup serve content from root user).  If
145
+
146
+# root Access
147
+# -----------
148
+
149
+# OpenStack is designed to be run as a non-root user; Horizon will fail to run
150
+# as **root** since Apache will not serve content from **root** user).  If
147 151
 # ``stack.sh`` is run as **root**, it automatically creates a **stack** user with
148 152
 # sudo privileges and runs as that user.
149 153
 
... ...
@@ -153,8 +163,7 @@ if [[ $EUID -eq 0 ]]; then
153 153
     echo "In $ROOTSLEEP seconds, we will create a user 'stack' and run as that user"
154 154
     sleep $ROOTSLEEP
155 155
 
156
-    # since this script runs as a normal user, we need to give that user
157
-    # ability to run sudo
156
+    # Give the non-root user the ability to run as **root** via ``sudo``
158 157
     if [[ "$os_PACKAGE" = "deb" ]]; then
159 158
         dpkg -l sudo || apt_get update && install_package sudo
160 159
     else
... ...
@@ -170,7 +179,7 @@ if [[ $EUID -eq 0 ]]; then
170 170
     fi
171 171
 
172 172
     echo "Giving stack user passwordless sudo priviledges"
173
-    # some uec images sudoers does not have a '#includedir'. add one.
173
+    # UEC images ``/etc/sudoers`` does not have a ``#includedir``, add one
174 174
     grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers ||
175 175
         echo "#includedir /etc/sudoers.d" >> /etc/sudoers
176 176
     ( umask 226 && echo "stack ALL=(ALL) NOPASSWD:ALL" \
... ...
@@ -187,7 +196,7 @@ if [[ $EUID -eq 0 ]]; then
187 187
     fi
188 188
     exit 1
189 189
 else
190
-    # We're not root, make sure sudo is available
190
+    # We're not **root**, make sure ``sudo`` is available
191 191
     if [[ "$os_PACKAGE" = "deb" ]]; then
192 192
         CHECK_SUDO_CMD="dpkg -l sudo"
193 193
     else
... ...
@@ -195,7 +204,7 @@ else
195 195
     fi
196 196
     $CHECK_SUDO_CMD || die "Sudo is required.  Re-run stack.sh as root ONE TIME ONLY to set up sudo."
197 197
 
198
-    # UEC images /etc/sudoers does not have a '#includedir'. add one.
198
+    # UEC images ``/etc/sudoers`` does not have a ``#includedir``, add one
199 199
     sudo grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers ||
200 200
         echo "#includedir /etc/sudoers.d" | sudo tee -a /etc/sudoers
201 201
 
... ...
@@ -219,14 +228,14 @@ if [ ! -w $DEST ]; then
219 219
     sudo chown `whoami` $DEST
220 220
 fi
221 221
 
222
-# Set True to configure ``stack.sh`` to run cleanly without Internet access.
223
-# ``stack.sh`` must have been previously run with Internet access to install
224
-# prerequisites and initialize ``$DEST``.
222
+# Set ``OFFLINE`` to ``True`` to configure ``stack.sh`` to run cleanly without
223
+# Internet access. ``stack.sh`` must have been previously run with Internet
224
+# access to install prerequisites and fetch repositories.
225 225
 OFFLINE=`trueorfalse False $OFFLINE`
226 226
 
227
-# Set True to configure ``stack.sh`` to exit with an error code if it is asked
228
-# to clone any git repositories.  If devstack is used in a testing environment,
229
-# this may be used to ensure that the correct code is being tested.
227
+# Set ``ERROR_ON_CLONE`` to ``True`` to configure ``stack.sh`` to exit if
228
+# the destination git repository does not exist during the ``git_clone``
229
+# operation.
230 230
 ERROR_ON_CLONE=`trueorfalse False $ERROR_ON_CLONE`
231 231
 
232 232
 # Destination path for service data
... ...
@@ -235,15 +244,15 @@ sudo mkdir -p $DATA_DIR
235 235
 sudo chown `whoami` $DATA_DIR
236 236
 
237 237
 
238
-# Projects
239
-# --------
238
+# Configure Projects
239
+# ==================
240 240
 
241 241
 # Get project function libraries
242 242
 source $TOP_DIR/lib/cinder
243 243
 source $TOP_DIR/lib/ceilometer
244 244
 source $TOP_DIR/lib/heat
245 245
 
246
-# Set the destination directories for openstack projects
246
+# Set the destination directories for OpenStack projects
247 247
 NOVA_DIR=$DEST/nova
248 248
 HORIZON_DIR=$DEST/horizon
249 249
 GLANCE_DIR=$DEST/glance
... ...
@@ -273,17 +282,19 @@ Q_AUTH_STRATEGY=${Q_AUTH_STRATEGY:-keystone}
273 273
 # Use namespace or not
274 274
 Q_USE_NAMESPACE=${Q_USE_NAMESPACE:-True}
275 275
 
276
-# Name of the lvm volume group to use/create for iscsi volumes
276
+# Name of the LVM volume group to use/create for iscsi volumes
277 277
 VOLUME_GROUP=${VOLUME_GROUP:-stack-volumes}
278 278
 VOLUME_NAME_PREFIX=${VOLUME_NAME_PREFIX:-volume-}
279 279
 INSTANCE_NAME_PREFIX=${INSTANCE_NAME_PREFIX:-instance-}
280 280
 
281
-# Nova supports pluggable schedulers.  ``FilterScheduler`` should work in most
282
-# cases.
281
+# Nova supports pluggable schedulers.  The default ``FilterScheduler``
282
+# should work in most cases.
283 283
 SCHEDULER=${SCHEDULER:-nova.scheduler.filter_scheduler.FilterScheduler}
284 284
 
285 285
 # Set fixed and floating range here so we can make sure not to use addresses
286
-# from either range when attempting to guess the ip to use for the host
286
+# from either range when attempting to guess the IP to use for the host.
287
+# Note that setting FIXED_RANGE may be necessary when running DevStack
288
+# in an OpenStack cloud that uses eith of these address ranges internally.
287 289
 FIXED_RANGE=${FIXED_RANGE:-10.0.0.0/24}
288 290
 FLOATING_RANGE=${FLOATING_RANGE:-172.24.4.224/28}
289 291
 
... ...
@@ -294,10 +305,12 @@ if [ -z "$HOST_IP" -o "$HOST_IP" == "dhcp" ]; then
294 294
     HOST_IP=""
295 295
     HOST_IPS=`LC_ALL=C ip -f inet addr show ${HOST_IP_IFACE} | awk '/inet/ {split($2,parts,"/");  print parts[1]}'`
296 296
     for IP in $HOST_IPS; do
297
-        # Attempt to filter out ip addresses that are part of the fixed and
298
-        # floating range. Note that this method only works if the 'netaddr'
297
+        # Attempt to filter out IP addresses that are part of the fixed and
298
+        # floating range. Note that this method only works if the ``netaddr``
299 299
         # python library is installed. If it is not installed, an error
300
-        # will be printed and the first ip from the interface will be used.
300
+        # will be printed and the first IP from the interface will be used.
301
+        # If that is not correct set ``HOST_IP`` in ``localrc`` to the correct
302
+        # address.
301 303
         if ! (address_in_net $IP $FIXED_RANGE || address_in_net $IP $FLOATING_RANGE); then
302 304
             HOST_IP=$IP
303 305
             break;
... ...
@@ -318,7 +331,7 @@ SYSLOG=`trueorfalse False $SYSLOG`
318 318
 SYSLOG_HOST=${SYSLOG_HOST:-$HOST_IP}
319 319
 SYSLOG_PORT=${SYSLOG_PORT:-516}
320 320
 
321
-# Use color for logging output
321
+# Use color for logging output (only available if syslog is not used)
322 322
 LOG_COLOR=`trueorfalse True $LOG_COLOR`
323 323
 
324 324
 # Service startup timeout
... ...
@@ -374,7 +387,7 @@ function read_password {
374 374
 
375 375
 if [ "$VIRT_DRIVER" = 'xenserver' ]; then
376 376
     PUBLIC_INTERFACE_DEFAULT=eth3
377
-    # allow build_domU.sh to specify the flat network bridge via kernel args
377
+    # Allow ``build_domU.sh`` to specify the flat network bridge via kernel args
378 378
     FLAT_NETWORK_BRIDGE_DEFAULT=$(grep -o 'flat_network_bridge=[[:alnum:]]*' /proc/cmdline | cut -d= -f 2 | sort -u)
379 379
     GUEST_INTERFACE_DEFAULT=eth1
380 380
 else
... ...
@@ -396,19 +409,19 @@ VLAN_INTERFACE=${VLAN_INTERFACE:-$GUEST_INTERFACE_DEFAULT}
396 396
 TEST_FLOATING_POOL=${TEST_FLOATING_POOL:-test}
397 397
 TEST_FLOATING_RANGE=${TEST_FLOATING_RANGE:-192.168.253.0/29}
398 398
 
399
-# **MULTI_HOST** is a mode where each compute node runs its own network node.  This
399
+# ``MULTI_HOST`` is a mode where each compute node runs its own network node.  This
400 400
 # allows network operations and routing for a VM to occur on the server that is
401 401
 # running the VM - removing a SPOF and bandwidth bottleneck.
402 402
 MULTI_HOST=`trueorfalse False $MULTI_HOST`
403 403
 
404
-# If you are using FlatDHCP on multiple hosts, set the ``FLAT_INTERFACE``
405
-# variable but make sure that the interface doesn't already have an
406
-# ip or you risk breaking things.
404
+# If you are using the FlatDHCP network mode on multiple hosts, set the
405
+# ``FLAT_INTERFACE`` variable but make sure that the interface doesn't already
406
+# have an IP or you risk breaking things.
407 407
 #
408 408
 # **DHCP Warning**:  If your flat interface device uses DHCP, there will be a
409 409
 # hiccup while the network is moved from the flat interface to the flat network
410 410
 # bridge.  This will happen when you launch your first instance.  Upon launch
411
-# you will lose all connectivity to the node, and the vm launch will probably
411
+# you will lose all connectivity to the node, and the VM launch will probably
412 412
 # fail.
413 413
 #
414 414
 # If you are running on a single node and don't need to access the VMs from
... ...
@@ -431,6 +444,7 @@ FLAT_INTERFACE=${FLAT_INTERFACE:-$GUEST_INTERFACE_DEFAULT}
431 431
 #
432 432
 # With Quantum networking the NET_MAN variable is ignored.
433 433
 
434
+
434 435
 # MySQL & (RabbitMQ or Qpid)
435 436
 # --------------------------
436 437
 
... ...
@@ -446,7 +460,7 @@ MYSQL_HOST=${MYSQL_HOST:-localhost}
446 446
 MYSQL_USER=${MYSQL_USER:-root}
447 447
 read_password MYSQL_PASSWORD "ENTER A PASSWORD TO USE FOR MYSQL."
448 448
 
449
-# NOTE: Don't specify /db in this string so we can use it for multiple services
449
+# NOTE: Don't specify ``/db`` in this string so we can use it for multiple services
450 450
 BASE_SQL_CONN=${BASE_SQL_CONN:-mysql://$MYSQL_USER:$MYSQL_PASSWORD@$MYSQL_HOST}
451 451
 
452 452
 # Rabbit connection info
... ...
@@ -455,6 +469,10 @@ if is_service_enabled rabbit; then
455 455
     read_password RABBIT_PASSWORD "ENTER A PASSWORD TO USE FOR RABBIT."
456 456
 fi
457 457
 
458
+
459
+# Glance
460
+# ------
461
+
458 462
 # Glance connection info.  Note the port must be specified.
459 463
 GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$SERVICE_HOST:9292}
460 464
 
... ...
@@ -464,19 +482,17 @@ GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$SERVICE_HOST:9292}
464 464
 
465 465
 # TODO: add logging to different location.
466 466
 
467
-# By default the location of swift drives and objects is located inside
468
-# the swift source directory. SWIFT_DATA_DIR variable allow you to redefine
469
-# this.
467
+# Set ``SWIFT_DATA_DIR`` to the location of swift drives and objects.
468
+# Default is the common DevStack data directory.
470 469
 SWIFT_DATA_DIR=${SWIFT_DATA_DIR:-${DEST}/data/swift}
471 470
 
472
-# We are going to have the configuration files inside the source
473
-# directory, change SWIFT_CONFIG_DIR if you want to adjust that.
471
+# Set ``SWIFT_CONFIG_DIR`` to the location of the configuration files.
472
+# Default is ``/etc/swift``.
474 473
 SWIFT_CONFIG_DIR=${SWIFT_CONFIG_DIR:-/etc/swift}
475 474
 
476 475
 # DevStack will create a loop-back disk formatted as XFS to store the
477
-# swift data. By default the disk size is 1 gigabyte. The variable
478
-# SWIFT_LOOPBACK_DISK_SIZE specified in bytes allow you to change
479
-# that.
476
+# swift data. Set ``SWIFT_LOOPBACK_DISK_SIZE`` to the disk size in bytes.
477
+# Default is 1 gigabyte.
480 478
 SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-1000000}
481 479
 
482 480
 # The ring uses a configurable number of bits from a path’s MD5 hash as
... ...
@@ -489,7 +505,7 @@ SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-1000000}
489 489
 # By default we define 9 for the partition count (which mean 512).
490 490
 SWIFT_PARTITION_POWER_SIZE=${SWIFT_PARTITION_POWER_SIZE:-9}
491 491
 
492
-# This variable allows you to configure how many replicas you want to be
492
+# Set ``SWIFT_REPLICAS`` to configure how many replicas are to be
493 493
 # configured for your Swift cluster.  By default the three replicas would need a
494 494
 # bit of IO and Memory on a VM you may want to lower that to 1 if you want to do
495 495
 # only some quick testing.
... ...
@@ -514,8 +530,8 @@ S3_SERVICE_PORT=${S3_SERVICE_PORT:-3333}
514 514
 # Keystone
515 515
 # --------
516 516
 
517
-# Service Token - Openstack components need to have an admin token
518
-# to validate user tokens.
517
+# The ``SERVICE_TOKEN`` is used to bootstrap the Keystone database.  It is
518
+# just a string and is not a 'real' Keystone token.
519 519
 read_password SERVICE_TOKEN "ENTER A SERVICE_TOKEN TO USE FOR THE SERVICE ADMIN TOKEN."
520 520
 # Services authenticate to Identity with servicename/SERVICE_PASSWORD
521 521
 read_password SERVICE_PASSWORD "ENTER A SERVICE_PASSWORD TO USE FOR THE SERVICE AUTHENTICATION."
... ...
@@ -547,10 +563,10 @@ APACHE_GROUP=${APACHE_GROUP:-$APACHE_USER}
547 547
 # Log files
548 548
 # ---------
549 549
 
550
-# Set up logging for stack.sh
551
-# Set LOGFILE to turn on logging
552
-# We append '.xxxxxxxx' to the given name to maintain history
553
-# where xxxxxxxx is a representation of the date the file was created
550
+# Set up logging for ``stack.sh``
551
+# Set ``LOGFILE`` to turn on logging
552
+# Append '.xxxxxxxx' to the given name to maintain history
553
+# where 'xxxxxxxx' is a representation of the date the file was created
554 554
 if [[ -n "$LOGFILE" || -n "$SCREEN_LOGDIR" ]]; then
555 555
     LOGDAYS=${LOGDAYS:-7}
556 556
     TIMESTAMP_FORMAT=${TIMESTAMP_FORMAT:-"%F-%H%M%S"}
... ...
@@ -558,7 +574,7 @@ if [[ -n "$LOGFILE" || -n "$SCREEN_LOGDIR" ]]; then
558 558
 fi
559 559
 
560 560
 if [[ -n "$LOGFILE" ]]; then
561
-    # First clean up old log files.  Use the user-specified LOGFILE
561
+    # First clean up old log files.  Use the user-specified ``LOGFILE``
562 562
     # as the template to search for, appending '.*' to match the date
563 563
     # we added on earlier runs.
564 564
     LOGDIR=$(dirname "$LOGFILE")
... ...
@@ -575,11 +591,11 @@ if [[ -n "$LOGFILE" ]]; then
575 575
 fi
576 576
 
577 577
 # Set up logging of screen windows
578
-# Set SCREEN_LOGDIR to turn on logging of screen windows to the
579
-# directory specified in SCREEN_LOGDIR, we will log to the the file
580
-# screen-$SERVICE_NAME-$TIMESTAMP.log in that dir and have a link
581
-# screen-$SERVICE_NAME.log to the latest log file.
582
-# Logs are kept for as long specified in LOGDAYS.
578
+# Set ``SCREEN_LOGDIR`` to turn on logging of screen windows to the
579
+# directory specified in ``SCREEN_LOGDIR``, we will log to the the file
580
+# ``screen-$SERVICE_NAME-$TIMESTAMP.log`` in that dir and have a link
581
+# ``screen-$SERVICE_NAME.log`` to the latest log file.
582
+# Logs are kept for as long specified in ``LOGDAYS``.
583 583
 if [[ -n "$SCREEN_LOGDIR" ]]; then
584 584
 
585 585
     # We make sure the directory is created.
... ...
@@ -591,8 +607,11 @@ if [[ -n "$SCREEN_LOGDIR" ]]; then
591 591
     fi
592 592
 fi
593 593
 
594
-# So that errors don't compound we exit on any errors so you see only the
595
-# first error that occurred.
594
+
595
+# Set Up Script Execution
596
+# -----------------------
597
+
598
+# Exit on any errors so that errors don't compound
596 599
 trap failed ERR
597 600
 failed() {
598 601
     local r=$?
... ...
@@ -609,7 +628,7 @@ set -o xtrace
609 609
 # Install Packages
610 610
 # ================
611 611
 
612
-# Openstack uses a fair number of other projects.
612
+# OpenStack uses a fair number of other projects.
613 613
 
614 614
 # Install package requirements
615 615
 if [[ "$os_PACKAGE" = "deb" ]]; then
... ...
@@ -650,7 +669,7 @@ mysql-server-5.1 mysql-server/start_on_boot boolean true
650 650
 MYSQL_PRESEED
651 651
     fi
652 652
 
653
-    # while ``.my.cnf`` is not needed for openstack to function, it is useful
653
+    # while ``.my.cnf`` is not needed for OpenStack to function, it is useful
654 654
     # as it allows you to access the mysql databases via ``mysql nova`` instead
655 655
     # of having to specify the username/password each time.
656 656
     if [[ ! -e $HOME/.my.cnf ]]; then
... ...
@@ -702,8 +721,6 @@ fi
702 702
 
703 703
 if is_service_enabled n-cpu; then
704 704
 
705
-    # Virtualization Configuration
706
-    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
707 705
     if [[ "$os_PACKAGE" = "deb" ]]; then
708 706
         LIBVIRT_PKG_NAME=libvirt-bin
709 707
     else
... ...
@@ -746,7 +763,10 @@ fi
746 746
 # Install python requirements
747 747
 pip_install $(get_packages $FILES/pips | sort -u)
748 748
 
749
-# Check out OpenStack sources
749
+
750
+# Check Out Source
751
+# ----------------
752
+
750 753
 git_clone $NOVA_REPO $NOVA_DIR $NOVA_BRANCH
751 754
 
752 755
 # Check out the client libs that are used most
... ...
@@ -799,6 +819,7 @@ if is_service_enabled ceilometer; then
799 799
     install_ceilometer
800 800
 fi
801 801
 
802
+
802 803
 # Initialization
803 804
 # ==============
804 805
 
... ...
@@ -822,6 +843,7 @@ if is_service_enabled g-api n-api; then
822 822
 fi
823 823
 
824 824
 # Do this _after_ glance is installed to override the old binary
825
+# TODO(dtroyer): figure out when this is no longer necessary
825 826
 setup_develop $GLANCECLIENT_DIR
826 827
 
827 828
 setup_develop $NOVA_DIR
... ...
@@ -848,6 +870,7 @@ if [[ $TRACK_DEPENDS = True ]] ; then
848 848
     exit 0
849 849
 fi
850 850
 
851
+
851 852
 # Syslog
852 853
 # ------
853 854
 
... ...
@@ -889,10 +912,9 @@ fi
889 889
 # Mysql
890 890
 # -----
891 891
 
892
-
893 892
 if is_service_enabled mysql; then
894 893
 
895
-    #start mysql-server
894
+    # Start mysql-server
896 895
     if [[ "$os_PACKAGE" = "rpm" ]]; then
897 896
         # RPM doesn't start the service
898 897
         start_service mysqld
... ...
@@ -1015,7 +1037,8 @@ if is_service_enabled horizon; then
1015 1015
         APACHE_CONF=conf.d/horizon.conf
1016 1016
         sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
1017 1017
     fi
1018
-    ## Configure apache to run horizon
1018
+
1019
+    # Configure apache to run horizon
1019 1020
     sudo sh -c "sed -e \"
1020 1021
         s,%USER%,$APACHE_USER,g;
1021 1022
         s,%GROUP%,$APACHE_GROUP,g;
... ...
@@ -1023,6 +1046,7 @@ if is_service_enabled horizon; then
1023 1023
         s,%APACHE_NAME%,$APACHE_NAME,g;
1024 1024
         s,%DEST%,$DEST,g;
1025 1025
     \" $FILES/apache-horizon.template >/etc/$APACHE_NAME/$APACHE_CONF"
1026
+
1026 1027
     restart_service $APACHE_NAME
1027 1028
 fi
1028 1029
 
... ...
@@ -1106,7 +1130,7 @@ fi
1106 1106
 # -------
1107 1107
 
1108 1108
 if is_service_enabled quantum; then
1109
-    # Put config files in /etc/quantum for everyone to find
1109
+    # Put config files in ``/etc/quantum`` for everyone to find
1110 1110
     if [[ ! -d /etc/quantum ]]; then
1111 1111
         sudo mkdir -p /etc/quantum
1112 1112
     fi
... ...
@@ -1127,7 +1151,7 @@ if is_service_enabled quantum; then
1127 1127
         exit 1
1128 1128
     fi
1129 1129
 
1130
-    # If needed, move config file from $QUANTUM_DIR/etc/quantum to /etc/quantum
1130
+    # If needed, move config file from ``$QUANTUM_DIR/etc/quantum`` to ``/etc/quantum``
1131 1131
     mkdir -p /$Q_PLUGIN_CONF_PATH
1132 1132
     Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME
1133 1133
     cp $QUANTUM_DIR/$Q_PLUGIN_CONF_FILE /$Q_PLUGIN_CONF_FILE
... ...
@@ -1248,10 +1272,11 @@ screen_it q-agt "sudo python $AGENT_BINARY --config-file $Q_CONF_FILE --config-f
1248 1248
 # Start up the quantum agent
1249 1249
 screen_it q-dhcp "sudo python $AGENT_DHCP_BINARY --config-file $Q_CONF_FILE --config-file=$Q_DHCP_CONF_FILE"
1250 1250
 
1251
+
1251 1252
 # Nova
1252 1253
 # ----
1253 1254
 
1254
-# Put config files in /etc/nova for everyone to find
1255
+# Put config files in ``/etc/nova`` for everyone to find
1255 1256
 NOVA_CONF_DIR=/etc/nova
1256 1257
 if [[ ! -d $NOVA_CONF_DIR ]]; then
1257 1258
     sudo mkdir -p $NOVA_CONF_DIR
... ...
@@ -1261,7 +1286,7 @@ sudo chown `whoami` $NOVA_CONF_DIR
1261 1261
 cp -p $NOVA_DIR/etc/nova/policy.json $NOVA_CONF_DIR
1262 1262
 
1263 1263
 # If Nova ships the new rootwrap filters files, deploy them
1264
-# (owned by root) and add a parameter to $NOVA_ROOTWRAP
1264
+# (owned by root) and add a parameter to ``$NOVA_ROOTWRAP``
1265 1265
 ROOTWRAP_SUDOER_CMD="$NOVA_ROOTWRAP"
1266 1266
 if [[ -d $NOVA_DIR/etc/nova/rootwrap.d ]]; then
1267 1267
     # Wipe any existing rootwrap.d files first
... ...
@@ -1334,7 +1359,7 @@ if is_service_enabled n-cpu; then
1334 1334
     # Force IP forwarding on, just on case
1335 1335
     sudo sysctl -w net.ipv4.ip_forward=1
1336 1336
 
1337
-    # attempt to load modules: network block device - used to manage qcow images
1337
+    # Attempt to load modules: network block device - used to manage qcow images
1338 1338
     sudo modprobe nbd || true
1339 1339
 
1340 1340
     # Check for kvm (hardware based virtualization).  If unable to initialize
... ...
@@ -1398,9 +1423,11 @@ ResultActive=yes
1398 1398
 EOF'
1399 1399
         LIBVIRT_DAEMON=libvirtd
1400 1400
     fi
1401
-    # The user that nova runs as needs to be member of libvirtd group otherwise
1401
+
1402
+    # The user that nova runs as needs to be member of **libvirtd** group otherwise
1402 1403
     # nova-compute will be unable to use libvirt.
1403 1404
     sudo usermod -a -G libvirtd `whoami`
1405
+
1404 1406
     # libvirt detects various settings on startup, as we potentially changed
1405 1407
     # the system configuration (modules, filesystems), we need to restart
1406 1408
     # libvirt to detect those changes.
... ...
@@ -1458,17 +1485,17 @@ fi
1458 1458
 
1459 1459
 if is_service_enabled swift; then
1460 1460
 
1461
-    # We make sure to kill all swift processes first
1461
+    # Make sure to kill all swift processes first
1462 1462
     swift-init all stop || true
1463 1463
 
1464
-    # We first do a bit of setup by creating the directories and
1464
+    # First do a bit of setup by creating the directories and
1465 1465
     # changing the permissions so we can run it as our user.
1466 1466
 
1467 1467
     USER_GROUP=$(id -g)
1468 1468
     sudo mkdir -p ${SWIFT_DATA_DIR}/drives
1469 1469
     sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_DIR}
1470 1470
 
1471
-    # We then create a loopback disk and format it to XFS.
1471
+    # Create a loopback disk and format it to XFS.
1472 1472
     if [[ -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then
1473 1473
         if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
1474 1474
             sudo umount ${SWIFT_DATA_DIR}/drives/sdb1
... ...
@@ -1481,24 +1508,22 @@ if is_service_enabled swift; then
1481 1481
         dd if=/dev/zero of=${SWIFT_DATA_DIR}/drives/images/swift.img \
1482 1482
             bs=1024 count=0 seek=${SWIFT_LOOPBACK_DISK_SIZE}
1483 1483
     fi
1484
+
1484 1485
     # Make a fresh XFS filesystem
1485 1486
     mkfs.xfs -f -i size=1024  ${SWIFT_DATA_DIR}/drives/images/swift.img
1486 1487
 
1487
-    # After the drive being created we mount the disk with a few mount
1488
-    # options to make it most efficient as possible for swift.
1488
+    # Mount the disk with mount options to make it as efficient as possible
1489 1489
     mkdir -p ${SWIFT_DATA_DIR}/drives/sdb1
1490 1490
     if ! egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
1491 1491
         sudo mount -t xfs -o loop,noatime,nodiratime,nobarrier,logbufs=8  \
1492 1492
             ${SWIFT_DATA_DIR}/drives/images/swift.img ${SWIFT_DATA_DIR}/drives/sdb1
1493 1493
     fi
1494 1494
 
1495
-    # We then create link to that mounted location so swift would know
1496
-    # where to go.
1495
+    # Create a link to the above mount
1497 1496
     for x in $(seq ${SWIFT_REPLICAS}); do
1498 1497
         sudo ln -sf ${SWIFT_DATA_DIR}/drives/sdb1/$x ${SWIFT_DATA_DIR}/$x; done
1499 1498
 
1500
-    # We now have to emulate a few different servers into one we
1501
-    # create all the directories needed for swift
1499
+    # Create all of the directories needed to emulate a few different servers
1502 1500
     for x in $(seq ${SWIFT_REPLICAS}); do
1503 1501
             drive=${SWIFT_DATA_DIR}/drives/sdb1/${x}
1504 1502
             node=${SWIFT_DATA_DIR}/${x}/node
... ...
@@ -1514,7 +1539,7 @@ if is_service_enabled swift; then
1514 1514
    sudo chown -R $USER: ${SWIFT_CONFIG_DIR} /var/run/swift
1515 1515
 
1516 1516
     if [[ "$SWIFT_CONFIG_DIR" != "/etc/swift" ]]; then
1517
-        # Some swift tools are hard-coded to use /etc/swift and are apparenty not going to be fixed.
1517
+        # Some swift tools are hard-coded to use ``/etc/swift`` and are apparenty not going to be fixed.
1518 1518
         # Create a symlink if the config dir is moved
1519 1519
         sudo ln -sf ${SWIFT_CONFIG_DIR} /etc/swift
1520 1520
     fi
... ...
@@ -1605,9 +1630,8 @@ EOF
1605 1605
     cp ${SWIFT_DIR}/etc/swift.conf-sample ${SWIFT_CONFIG_DIR}/swift.conf
1606 1606
     iniset ${SWIFT_CONFIG_DIR}/swift.conf swift-hash swift_hash_path_suffix ${SWIFT_HASH}
1607 1607
 
1608
-    # We need to generate a object/account/proxy configuration
1609
-    # emulating 4 nodes on different ports we have a little function
1610
-    # that help us doing that.
1608
+    # This function generates an object/account/proxy configuration
1609
+    # emulating 4 nodes on different ports
1611 1610
     function generate_swift_configuration() {
1612 1611
         local server_type=$1
1613 1612
         local bind_port=$2
... ...
@@ -1650,8 +1674,8 @@ EOF
1650 1650
     generate_swift_configuration container 6011 2
1651 1651
     generate_swift_configuration account 6012 2
1652 1652
 
1653
-    # We have some specific configuration for swift for rsyslog. See
1654
-    # the file /etc/rsyslog.d/10-swift.conf for more info.
1653
+    # Specific configuration for swift for rsyslog. See
1654
+    # ``/etc/rsyslog.d/10-swift.conf`` for more info.
1655 1655
     swift_log_dir=${SWIFT_DATA_DIR}/logs
1656 1656
     rm -rf ${swift_log_dir}
1657 1657
     mkdir -p ${swift_log_dir}/hourly
... ...
@@ -1692,7 +1716,7 @@ EOF
1692 1692
 
1693 1693
     } && popd >/dev/null
1694 1694
 
1695
-   # We then can start rsync.
1695
+   # Start rsync
1696 1696
     if [[ "$os_PACKAGE" = "deb" ]]; then
1697 1697
         sudo /etc/init.d/rsync restart || :
1698 1698
     else
... ...
@@ -1745,7 +1769,7 @@ elif is_service_enabled n-vol; then
1745 1745
         sudo tgtadm --op show --mode target | grep $VOLUME_NAME_PREFIX | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true
1746 1746
         # Clean out existing volumes
1747 1747
         for lv in `sudo lvs --noheadings -o lv_name $VOLUME_GROUP`; do
1748
-            # VOLUME_NAME_PREFIX prefixes the LVs we want
1748
+            # ``VOLUME_NAME_PREFIX`` prefixes the LVs we want
1749 1749
             if [[ "${lv#$VOLUME_NAME_PREFIX}" != "$lv" ]]; then
1750 1750
                 sudo lvremove -f $VOLUME_GROUP/$lv
1751 1751
             fi
... ...
@@ -1781,10 +1805,10 @@ function add_nova_opt {
1781 1781
     echo "$1" >> $NOVA_CONF_DIR/$NOVA_CONF
1782 1782
 }
1783 1783
 
1784
-# Remove legacy nova.conf
1784
+# Remove legacy ``nova.conf``
1785 1785
 rm -f $NOVA_DIR/bin/nova.conf
1786 1786
 
1787
-# (re)create nova.conf
1787
+# (Re)create ``nova.conf``
1788 1788
 rm -f $NOVA_CONF_DIR/$NOVA_CONF
1789 1789
 add_nova_opt "[DEFAULT]"
1790 1790
 add_nova_opt "verbose=True"
... ...
@@ -1894,13 +1918,13 @@ if is_service_enabled cinder; then
1894 1894
     add_nova_opt "volume_api_class=nova.volume.cinder.API"
1895 1895
 fi
1896 1896
 
1897
-# Provide some transition from EXTRA_FLAGS to EXTRA_OPTS
1897
+# Provide some transition from ``EXTRA_FLAGS`` to ``EXTRA_OPTS``
1898 1898
 if [[ -z "$EXTRA_OPTS" && -n "$EXTRA_FLAGS" ]]; then
1899 1899
     EXTRA_OPTS=$EXTRA_FLAGS
1900 1900
 fi
1901 1901
 
1902
-# You can define extra nova conf flags by defining the array EXTRA_OPTS,
1903
-# For Example: EXTRA_OPTS=(foo=true bar=2)
1902
+# Define extra nova conf flags by defining the array ``EXTRA_OPTS``.
1903
+# For Example: ``EXTRA_OPTS=(foo=true bar=2)``
1904 1904
 for I in "${EXTRA_OPTS[@]}"; do
1905 1905
     # Attempt to convert flags to options
1906 1906
     add_nova_opt ${I//--}
... ...
@@ -1937,42 +1961,46 @@ fi
1937 1937
 
1938 1938
 
1939 1939
 # Nova Database
1940
-# ~~~~~~~~~~~~~
1940
+# -------------
1941 1941
 
1942 1942
 # All nova components talk to a central database.  We will need to do this step
1943 1943
 # only once for an entire cluster.
1944 1944
 
1945 1945
 if is_service_enabled mysql && is_service_enabled nova; then
1946
-    # (re)create nova database
1946
+    # (Re)create nova database
1947 1947
     mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS nova;'
1948
+
1948 1949
     # Explicitly use latin1: to avoid lp#829209, nova expects the database to
1949 1950
     # use latin1 by default, and then upgrades the database to utf8 (see the
1950 1951
     # 082_essex.py in nova)
1951 1952
     mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE nova CHARACTER SET latin1;'
1952 1953
 
1953
-    # (re)create nova database
1954
+    # (Re)create nova database
1954 1955
     $NOVA_BIN_DIR/nova-manage db sync
1955 1956
 fi
1956 1957
 
1958
+
1957 1959
 # Heat
1958
-# ------
1960
+# ----
1961
+
1959 1962
 if is_service_enabled heat; then
1960 1963
     init_heat
1961 1964
 fi
1962 1965
 
1966
+
1963 1967
 # Launch Services
1964 1968
 # ===============
1965 1969
 
1966
-# nova api crashes if we start it with a regular screen command,
1970
+# Nova api crashes if we start it with a regular screen command,
1967 1971
 # so send the start command by forcing text into the window.
1968 1972
 # Only run the services specified in ``ENABLED_SERVICES``
1969 1973
 
1970
-# launch the glance registry service
1974
+# Launch the glance registry service
1971 1975
 if is_service_enabled g-reg; then
1972 1976
     screen_it g-reg "cd $GLANCE_DIR; bin/glance-registry --config-file=$GLANCE_CONF_DIR/glance-registry.conf"
1973 1977
 fi
1974 1978
 
1975
-# launch the glance api and wait for it to answer before continuing
1979
+# Launch the glance api and wait for it to answer before continuing
1976 1980
 if is_service_enabled g-api; then
1977 1981
     screen_it g-api "cd $GLANCE_DIR; bin/glance-api --config-file=$GLANCE_CONF_DIR/glance-api.conf"
1978 1982
     echo "Waiting for g-api ($GLANCE_HOSTPORT) to start..."
... ...
@@ -1983,7 +2011,7 @@ if is_service_enabled g-api; then
1983 1983
 fi
1984 1984
 
1985 1985
 if is_service_enabled key; then
1986
-    # (re)create keystone database
1986
+    # (Re)create keystone database
1987 1987
     mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS keystone;'
1988 1988
     mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE keystone CHARACTER SET utf8;'
1989 1989
 
... ...
@@ -2001,7 +2029,7 @@ if is_service_enabled key; then
2001 2001
         cp -p $KEYSTONE_DIR/etc/policy.json $KEYSTONE_CONF_DIR
2002 2002
     fi
2003 2003
 
2004
-    # Rewrite stock keystone.conf:
2004
+    # Rewrite stock ``keystone.conf``
2005 2005
     iniset $KEYSTONE_CONF DEFAULT admin_token "$SERVICE_TOKEN"
2006 2006
     iniset $KEYSTONE_CONF sql connection "$BASE_SQL_CONN/keystone?charset=utf8"
2007 2007
     iniset $KEYSTONE_CONF ec2 driver "keystone.contrib.ec2.backends.sql.Ec2"
... ...
@@ -2012,12 +2040,13 @@ if is_service_enabled key; then
2012 2012
     iniset $KEYSTONE_CONF filter:s3_extension paste.filter_factory "keystone.contrib.s3:S3Extension.factory"
2013 2013
 
2014 2014
     if [[ "$KEYSTONE_CATALOG_BACKEND" = "sql" ]]; then
2015
-        # Configure keystone.conf to use sql
2015
+        # Configure ``keystone.conf`` to use sql
2016 2016
         iniset $KEYSTONE_CONF catalog driver keystone.catalog.backends.sql.Catalog
2017 2017
         inicomment $KEYSTONE_CONF catalog template_file
2018 2018
     else
2019 2019
         KEYSTONE_CATALOG=$KEYSTONE_CONF_DIR/default_catalog.templates
2020 2020
         cp -p $FILES/default_catalog.templates $KEYSTONE_CATALOG
2021
+
2021 2022
         # Add swift endpoints to service catalog if swift is enabled
2022 2023
         if is_service_enabled swift; then
2023 2024
             echo "catalog.RegionOne.object_store.publicURL = http://%SERVICE_HOST%:8080/v1/AUTH_\$(tenant_id)s" >> $KEYSTONE_CATALOG
... ...
@@ -2039,7 +2068,7 @@ if is_service_enabled key; then
2039 2039
             s,%S3_SERVICE_PORT%,$S3_SERVICE_PORT,g;
2040 2040
         " -i $KEYSTONE_CATALOG
2041 2041
 
2042
-        # Configure keystone.conf to use templates
2042
+        # Configure ``keystone.conf`` to use templates
2043 2043
         iniset $KEYSTONE_CONF catalog driver "keystone.catalog.backends.templated.TemplatedCatalog"
2044 2044
         iniset $KEYSTONE_CONF catalog template_file "$KEYSTONE_CATALOG"
2045 2045
     fi
... ...
@@ -2056,10 +2085,11 @@ if is_service_enabled key; then
2056 2056
 
2057 2057
     # Initialize keystone database
2058 2058
     $KEYSTONE_DIR/bin/keystone-manage db_sync
2059
-    # set up certificates
2059
+
2060
+    # Set up certificates
2060 2061
     $KEYSTONE_DIR/bin/keystone-manage pki_setup
2061 2062
 
2062
-    # launch keystone and wait for it to answer before continuing
2063
+    # Launch keystone and wait for it to answer before continuing
2063 2064
     screen_it key "cd $KEYSTONE_DIR && $KEYSTONE_DIR/bin/keystone-all --config-file $KEYSTONE_CONF $KEYSTONE_LOG_CONFIG -d --debug"
2064 2065
     echo "Waiting for keystone to start..."
2065 2066
     if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= curl -s $KEYSTONE_AUTH_PROTOCOL://$SERVICE_HOST:$KEYSTONE_API_PORT/v2.0/ >/dev/null; do sleep 1; done"; then
... ...
@@ -2067,7 +2097,7 @@ if is_service_enabled key; then
2067 2067
       exit 1
2068 2068
     fi
2069 2069
 
2070
-    # keystone_data.sh creates services, admin and demo users, and roles.
2070
+    # ``keystone_data.sh`` creates services, admin and demo users, and roles.
2071 2071
     SERVICE_ENDPOINT=$KEYSTONE_AUTH_PROTOCOL://$KEYSTONE_AUTH_HOST:$KEYSTONE_AUTH_PORT/v2.0
2072 2072
 
2073 2073
     ADMIN_PASSWORD=$ADMIN_PASSWORD SERVICE_TENANT_NAME=$SERVICE_TENANT_NAME SERVICE_PASSWORD=$SERVICE_PASSWORD \
... ...
@@ -2113,7 +2143,7 @@ if is_service_enabled q-svc; then
2113 2113
 
2114 2114
     # Create a small network
2115 2115
     # Since quantum command is executed in admin context at this point,
2116
-    # --tenant_id needs to be specified.
2116
+    # ``--tenant_id`` needs to be specified.
2117 2117
     NET_ID=$(quantum net-create --tenant_id $TENANT_ID net1 | grep ' id ' | get_field 2)
2118 2118
     quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE
2119 2119
 elif is_service_enabled mysql && is_service_enabled nova; then
... ...
@@ -2127,12 +2157,9 @@ elif is_service_enabled mysql && is_service_enabled nova; then
2127 2127
     $NOVA_BIN_DIR/nova-manage floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL
2128 2128
 fi
2129 2129
 
2130
-# Launching nova-compute should be as simple as running ``nova-compute`` but
2131
-# have to do a little more than that in our script.  Since we add the group
2132
-# ``libvirtd`` to our user in this script, when nova-compute is run it is
2133
-# within the context of our original shell (so our groups won't be updated).
2134
-# Use 'sg' to execute nova-compute as a member of the libvirtd group.
2135
-# We don't check for is_service_enable as screen_it does it for us
2130
+# The group **libvirtd** is added to the current user in this script.
2131
+# Use 'sg' to execute nova-compute as a member of the **libvirtd** group.
2132
+# ``screen_it`` checks ``is_service_enabled``, it is not needed here
2136 2133
 screen_it n-cpu "cd $NOVA_DIR && sg libvirtd $NOVA_BIN_DIR/nova-compute"
2137 2134
 screen_it n-crt "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cert"
2138 2135
 screen_it n-vol "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-volume"
... ...
@@ -2161,18 +2188,17 @@ if is_service_enabled heat; then
2161 2161
     start_heat
2162 2162
 fi
2163 2163
 
2164
+
2164 2165
 # Install Images
2165 2166
 # ==============
2166 2167
 
2167 2168
 # Upload an image to glance.
2168 2169
 #
2169
-# The default image is cirros, a small testing image, which lets you login as root
2170
-#
2170
+# The default image is cirros, a small testing image which lets you login as **root**
2171 2171
 # cirros also uses ``cloud-init``, supporting login via keypair and sending scripts as
2172 2172
 # userdata.  See https://help.ubuntu.com/community/CloudInit for more on cloud-init
2173 2173
 #
2174
-# Override ``IMAGE_URLS`` with a comma-separated list of uec images.
2175
-#
2174
+# Override ``IMAGE_URLS`` with a comma-separated list of UEC images.
2176 2175
 #  * **oneiric**: http://uec-images.ubuntu.com/oneiric/current/oneiric-server-cloudimg-amd64.tar.gz
2177 2176
 #  * **precise**: http://uec-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64.tar.gz
2178 2177
 
... ...
@@ -2207,7 +2233,7 @@ set +o xtrace
2207 2207
 
2208 2208
 
2209 2209
 # Using the cloud
2210
-# ===============
2210
+# ---------------
2211 2211
 
2212 2212
 echo ""
2213 2213
 echo ""
... ...
@@ -2227,7 +2253,7 @@ if is_service_enabled key; then
2227 2227
     echo "The password: $ADMIN_PASSWORD"
2228 2228
 fi
2229 2229
 
2230
-# Echo HOST_IP - useful for build_uec.sh, which uses dhcp to give the instance an address
2230
+# Echo ``HOST_IP`` - useful for ``build_uec.sh``, which uses dhcp to give the instance an address
2231 2231
 echo "This is your host ip: $HOST_IP"
2232 2232
 
2233 2233
 # Warn that ``EXTRA_FLAGS`` needs to be converted to ``EXTRA_OPTS``
... ...
@@ -2235,5 +2261,5 @@ if [[ -n "$EXTRA_FLAGS" ]]; then
2235 2235
     echo "WARNING: EXTRA_FLAGS is defined and may need to be converted to EXTRA_OPTS"
2236 2236
 fi
2237 2237
 
2238
-# Indicate how long this took to run (bash maintained variable 'SECONDS')
2238
+# Indicate how long this took to run (bash maintained variable ``SECONDS``)
2239 2239
 echo "stack.sh completed in $SECONDS seconds."
... ...
@@ -1,3 +1,5 @@
1
+# stackrc
2
+#
1 3
 # Find the other rc files
2 4
 RC_DIR=$(cd $(dirname "$BASH_SOURCE") && pwd)
3 5
 
... ...
@@ -5,21 +7,22 @@ RC_DIR=$(cd $(dirname "$BASH_SOURCE") && pwd)
5 5
 DEST=/opt/stack
6 6
 
7 7
 # Specify which services to launch.  These generally correspond to
8
-# screen tabs. If you like to add other services that are not enabled
9
-# by default you can append them in your ENABLED_SERVICES variable in
10
-# your localrc. For example for swift you can just add this in your
11
-# localrc to add it with the other services:
12
-# ENABLED_SERVICES+=,swift
8
+# screen tabs. To change the default list, use the ``enable_service`` and
9
+# ``disable_service`` functions in ``localrc``.
10
+# For example, to enable Swift add this to ``localrc``:
11
+# enable_service swift
13 12
 #
14
-# If you like to explicitly remove services you can add a -$service in
15
-# ENABLED_SERVICES, for example in your localrc to install all defaults but not
16
-# cinder you would just need to set this :
17
-# ENABLED_SERVICES+=,-cinder
13
+# And to disable Cinder and use Nova Volumes instead:
14
+# disable_service c-api c-sch c-vol cinder
15
+# enable_service n-vol
18 16
 ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,mysql,rabbit
19 17
 
20 18
 # Set the default Nova APIs to enable
21 19
 NOVA_ENABLED_APIS=ec2,osapi_compute,osapi_volume,metadata
22 20
 
21
+# Repositories
22
+# ------------
23
+
23 24
 # Base GIT Repo URL
24 25
 # Another option is http://review.openstack.org/p
25 26
 GIT_BASE=https://github.com
... ...
@@ -46,7 +49,6 @@ SWIFT_BRANCH=master
46 46
 SWIFT3_REPO=https://github.com/fujita/swift3.git
47 47
 SWIFT3_BRANCH=master
48 48
 
49
-
50 49
 # python swift client library
51 50
 SWIFTCLIENT_REPO=${GIT_BASE}/openstack/python-swiftclient
52 51
 SWIFTCLIENT_BRANCH=master
... ...
@@ -75,7 +77,7 @@ HORIZON_BRANCH=master
75 75
 NOVACLIENT_REPO=${GIT_BASE}/openstack/python-novaclient.git
76 76
 NOVACLIENT_BRANCH=master
77 77
 
78
-# Shared openstack python client library
78
+# consolidated openstack python client
79 79
 OPENSTACKCLIENT_REPO=${GIT_BASE}/openstack/python-openstackclient.git
80 80
 OPENSTACKCLIENT_BRANCH=master
81 81
 
... ...
@@ -110,7 +112,7 @@ if [ -f $RC_DIR/localrc ]; then
110 110
     source $RC_DIR/localrc
111 111
 fi
112 112
 
113
-# Specify a comma-separated list of uec images to download and install into glance.
113
+# Specify a comma-separated list of UEC images to download and install into glance.
114 114
 # supported urls here are:
115 115
 #  * "uec-style" images:
116 116
 #     If the file ends in .tar.gz, uncompress the tarball and and select the first
... ...
@@ -123,13 +125,17 @@ fi
123 123
 #    example:
124 124
 #      http://cloud-images.ubuntu.com/releases/oneiric/release/ubuntu-11.10-server-cloudimg-armel-disk1.img
125 125
 #      http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-rootfs.img.gz
126
+#  * OpenVZ image:
127
+#    OpenVZ uses its own format of image, and does not support UEC style images
128
+
126 129
 #IMAGE_URLS="http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-11.2_2.6.35-15_1.tar.gz" # old ttylinux-uec image
127 130
 #IMAGE_URLS="http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img" # cirros full disk image
128
-#
129
-# Set default image based on LIBVIRT_TYPE or VIRT_DRIVER, which may be set in localrc
130
-# but allow DEFAULT_IMAGE_NAME and IMAGE_URLS to be set directly in localrc, too.
131
+
132
+# Set default image based on ``VIRT_DRIVER`` and ``LIBVIRT_TYPE``, either of
133
+# which may be set in ``localrc``.  Also allow ``DEFAULT_IMAGE_NAME`` and 
134
+# ``IMAGE_URLS`` to be set directly in ``localrc``.
131 135
 case "$VIRT_DRIVER" in
132
-    openvz) # OpenVZ uses its own format of image, and does not support uec style images
136
+    openvz) 
133 137
         DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-ubuntu-11.10-x86_64}
134 138
         IMAGE_URLS=${IMAGE_URLS:-"http://download.openvz.org/template/precreated/ubuntu-11.10-x86_64.tar.gz"};;
135 139
     libvirt)
... ...
@@ -6,7 +6,7 @@
6 6
 # mysql and rabbit are left running as OpenStack code refreshes
7 7
 # do not require them to be restarted.
8 8
 #
9
-# Stop all processes by setting UNSTACK_ALL or specifying ``--all``
9
+# Stop all processes by setting ``UNSTACK_ALL`` or specifying ``--all``
10 10
 # on the command line
11 11
 
12 12
 # Keep track of the current devstack directory.