Browse code

Clean up stack.sh config

* Clean up interactive configuration
* Complete moving initialization of service-specific varialbes into the
service lib/* files.
* Cosmetic cleanups

Change-Id: Iea14359bd224dd5533201d4c7cb1437d5382c4d1

Dean Troyer authored on 2013/03/19 06:07:56
Showing 6 changed files
... ...
@@ -53,6 +53,11 @@ fi
53 53
 # Support for multi lvm backend configuration (default is no support)
54 54
 CINDER_MULTI_LVM_BACKEND=$(trueorfalse False $CINDER_MULTI_LVM_BACKEND)
55 55
 
56
+# Should cinder perform secure deletion of volumes?
57
+# Defaults to true, can be set to False to avoid this bug when testing:
58
+# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1023755
59
+CINDER_SECURE_DELETE=`trueorfalse True $CINDER_SECURE_DELETE`
60
+
56 61
 # Name of the lvm volume groups to use/create for iscsi volumes
57 62
 # VOLUME_GROUP2 is used only if CINDER_MULTI_LVM_BACKEND = True
58 63
 VOLUME_GROUP=${VOLUME_GROUP:-stack-volumes}
... ...
@@ -59,6 +59,9 @@ KEYSTONE_SERVICE_PORT=${KEYSTONE_SERVICE_PORT:-5000}
59 59
 KEYSTONE_SERVICE_PORT_INT=${KEYSTONE_SERVICE_PORT_INT:-5001}
60 60
 KEYSTONE_SERVICE_PROTOCOL=${KEYSTONE_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
61 61
 
62
+# Set the tenant for service accounts in Keystone
63
+SERVICE_TENANT_NAME=${SERVICE_TENANT_NAME:-service}
64
+
62 65
 
63 66
 # Entry Points
64 67
 # ------------
... ...
@@ -65,6 +65,9 @@ SCHEDULER=${SCHEDULER:-nova.scheduler.filter_scheduler.FilterScheduler}
65 65
 
66 66
 QEMU_CONF=/etc/libvirt/qemu.conf
67 67
 
68
+NOVNC_DIR=$DEST/noVNC
69
+SPICE_DIR=$DEST/spice-html5
70
+
68 71
 
69 72
 # Nova Network Configuration
70 73
 # --------------------------
... ...
@@ -28,6 +28,7 @@ set +o xtrace
28 28
 SWIFT_DIR=$DEST/swift
29 29
 SWIFTCLIENT_DIR=$DEST/python-swiftclient
30 30
 SWIFT_AUTH_CACHE_DIR=${SWIFT_AUTH_CACHE_DIR:-/var/cache/swift}
31
+SWIFT3_DIR=$DEST/swift3
31 32
 
32 33
 # TODO: add logging to different location.
33 34
 
... ...
@@ -40,6 +41,12 @@ SWIFT_DATA_DIR=${SWIFT_DATA_DIR:-${DATA_DIR}/swift}
40 40
 # TODO(dtroyer): remove SWIFT_CONFIG_DIR after cutting stable/grizzly
41 41
 SWIFT_CONF_DIR=${SWIFT_CONF_DIR:-${SWIFT_CONFIG_DIR:-/etc/swift}}
42 42
 
43
+if is_service_enabled s-proxy && is_service_enabled swift3; then
44
+    # If we are using swift3, we can default the s3 port to swift instead
45
+    # of nova-objectstore
46
+    S3_SERVICE_PORT=${S3_SERVICE_PORT:-8080}
47
+fi
48
+
43 49
 # DevStack will create a loop-back disk formatted as XFS to store the
44 50
 # swift data. Set ``SWIFT_LOOPBACK_DISK_SIZE`` to the disk size in
45 51
 # kilobytes.
... ...
@@ -269,14 +269,12 @@ source $TOP_DIR/lib/ldap
269 269
 # Set the destination directories for OpenStack projects
270 270
 HORIZON_DIR=$DEST/horizon
271 271
 OPENSTACKCLIENT_DIR=$DEST/python-openstackclient
272
-NOVNC_DIR=$DEST/noVNC
273
-SPICE_DIR=$DEST/spice-html5
274
-SWIFT3_DIR=$DEST/swift3
275 272
 
276
-# Should cinder perform secure deletion of volumes?
277
-# Defaults to true, can be set to False to avoid this bug when testing:
278
-# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1023755
279
-CINDER_SECURE_DELETE=`trueorfalse True $CINDER_SECURE_DELETE`
273
+
274
+# Interactive Configuration
275
+# -------------------------
276
+
277
+# Do all interactive config up front before the logging spew begins
280 278
 
281 279
 # Generic helper to configure passwords
282 280
 function read_password {
... ...
@@ -322,7 +320,6 @@ function read_password {
322 322
 
323 323
 
324 324
 # Database Configuration
325
-# ----------------------
326 325
 
327 326
 # To select between database backends, add the following to ``localrc``:
328 327
 #
... ...
@@ -335,8 +332,7 @@ function read_password {
335 335
 initialize_database_backends && echo "Using $DATABASE_TYPE database backend" || echo "No database enabled"
336 336
 
337 337
 
338
-# RabbitMQ or Qpid
339
-# --------------------------
338
+# Queue Configuration
340 339
 
341 340
 # Rabbit connection info
342 341
 if is_service_enabled rabbit; then
... ...
@@ -344,53 +340,45 @@ if is_service_enabled rabbit; then
344 344
     read_password RABBIT_PASSWORD "ENTER A PASSWORD TO USE FOR RABBIT."
345 345
 fi
346 346
 
347
-if is_service_enabled s-proxy; then
348
-    # If we are using swift3, we can default the s3 port to swift instead
349
-    # of nova-objectstore
350
-    if is_service_enabled swift3;then
351
-        S3_SERVICE_PORT=${S3_SERVICE_PORT:-8080}
352
-    fi
353
-    # We only ask for Swift Hash if we have enabled swift service.
354
-    # ``SWIFT_HASH`` is a random unique string for a swift cluster that
355
-    # can never change.
356
-    read_password SWIFT_HASH "ENTER A RANDOM SWIFT HASH."
357
-fi
358
-
359
-# Set default port for nova-objectstore
360
-S3_SERVICE_PORT=${S3_SERVICE_PORT:-3333}
361
-
362 347
 
363 348
 # Keystone
364
-# --------
365 349
 
366
-# The ``SERVICE_TOKEN`` is used to bootstrap the Keystone database.  It is
367
-# just a string and is not a 'real' Keystone token.
368
-read_password SERVICE_TOKEN "ENTER A SERVICE_TOKEN TO USE FOR THE SERVICE ADMIN TOKEN."
369
-# Services authenticate to Identity with servicename/``SERVICE_PASSWORD``
370
-read_password SERVICE_PASSWORD "ENTER A SERVICE_PASSWORD TO USE FOR THE SERVICE AUTHENTICATION."
371
-# Horizon currently truncates usernames and passwords at 20 characters
372
-read_password ADMIN_PASSWORD "ENTER A PASSWORD TO USE FOR HORIZON AND KEYSTONE (20 CHARS OR LESS)."
373
-# Keystone can now optionally install OpenLDAP by adding ldap to the list
374
-# of enabled services in the localrc file (e.g. ENABLED_SERVICES=key,ldap).
375
-# If OpenLDAP has already been installed but you need to clear out
376
-# the Keystone contents of LDAP set KEYSTONE_CLEAR_LDAP to yes
377
-# (e.g. KEYSTONE_CLEAR_LDAP=yes ) in the localrc file.  To enable the
378
-# Keystone Identity Driver (keystone.identity.backends.ldap.Identity)
379
-# set KEYSTONE_IDENTITY_BACKEND to ldap (e.g. KEYSTONE_IDENTITY_BACKEND=ldap)
380
-# in the localrc file.
350
+if is_service_enabled key; then
351
+    # The ``SERVICE_TOKEN`` is used to bootstrap the Keystone database.  It is
352
+    # just a string and is not a 'real' Keystone token.
353
+    read_password SERVICE_TOKEN "ENTER A SERVICE_TOKEN TO USE FOR THE SERVICE ADMIN TOKEN."
354
+    # Services authenticate to Identity with servicename/``SERVICE_PASSWORD``
355
+    read_password SERVICE_PASSWORD "ENTER A SERVICE_PASSWORD TO USE FOR THE SERVICE AUTHENTICATION."
356
+    # Horizon currently truncates usernames and passwords at 20 characters
357
+    read_password ADMIN_PASSWORD "ENTER A PASSWORD TO USE FOR HORIZON AND KEYSTONE (20 CHARS OR LESS)."
358
+
359
+    # Keystone can now optionally install OpenLDAP by enabling the ``ldap``
360
+    # service in ``localrc`` (e.g. ``enable_service ldap``).
361
+    # To clean out the Keystone contents in OpenLDAP set ``KEYSTONE_CLEAR_LDAP``
362
+    # to ``yes`` (e.g. ``KEYSTONE_CLEAR_LDAP=yes``) in ``localrc``.  To enable the
363
+    # Keystone Identity Driver (``keystone.identity.backends.ldap.Identity``)
364
+    # set ``KEYSTONE_IDENTITY_BACKEND`` to ``ldap`` (e.g.
365
+    # ``KEYSTONE_IDENTITY_BACKEND=ldap``) in ``localrc``.
366
+
367
+    # only request ldap password if the service is enabled
368
+    if is_service_enabled ldap; then
369
+        read_password LDAP_PASSWORD "ENTER A PASSWORD TO USE FOR LDAP"
370
+    fi
371
+fi
381 372
 
382 373
 
383
-# only request ldap password if the service is enabled
384
-if is_service_enabled ldap; then
385
-    read_password LDAP_PASSWORD "ENTER A PASSWORD TO USE FOR LDAP"
386
-fi
374
+# Swift
387 375
 
388
-# Set the tenant for service accounts in Keystone
389
-SERVICE_TENANT_NAME=${SERVICE_TENANT_NAME:-service}
376
+if is_service_enabled s-proxy; then
377
+    # We only ask for Swift Hash if we have enabled swift service.
378
+    # ``SWIFT_HASH`` is a random unique string for a swift cluster that
379
+    # can never change.
380
+    read_password SWIFT_HASH "ENTER A RANDOM SWIFT HASH."
381
+fi
390 382
 
391 383
 
392
-# Log files
393
-# ---------
384
+# Configure logging
385
+# -----------------
394 386
 
395 387
 # Draw a spinner so the user knows something is happening
396 388
 function spinner() {
... ...
@@ -638,14 +626,15 @@ fi
638 638
 
639 639
 echo_summary "Configuring OpenStack projects"
640 640
 
641
-# Set up our checkouts so they are installed into python path
642
-# allowing ``import nova`` or ``import glance.client``
641
+# Set up our checkouts so they are installed in the python path
643 642
 configure_keystoneclient
644 643
 configure_novaclient
645 644
 setup_develop $OPENSTACKCLIENT_DIR
645
+
646 646
 if is_service_enabled key g-api n-api s-proxy; then
647 647
     configure_keystone
648 648
 fi
649
+
649 650
 if is_service_enabled s-proxy; then
650 651
     configure_swift
651 652
     configure_swiftclient
... ...
@@ -653,6 +642,7 @@ if is_service_enabled s-proxy; then
653 653
         setup_develop $SWIFT3_DIR
654 654
     fi
655 655
 fi
656
+
656 657
 if is_service_enabled g-api n-api; then
657 658
     configure_glance
658 659
 fi
... ...
@@ -666,17 +656,21 @@ if is_service_enabled nova; then
666 666
     cleanup_nova
667 667
     configure_nova
668 668
 fi
669
+
669 670
 if is_service_enabled horizon; then
670 671
     configure_horizon
671 672
 fi
673
+
672 674
 if is_service_enabled quantum; then
673 675
     setup_quantumclient
674 676
     setup_quantum
675 677
 fi
678
+
676 679
 if is_service_enabled heat; then
677 680
     configure_heat
678 681
     configure_heatclient
679 682
 fi
683
+
680 684
 if is_service_enabled cinder; then
681 685
     configure_cinder
682 686
 fi
... ...
@@ -698,6 +692,7 @@ if is_service_enabled tls-proxy; then
698 698
     # don't be naive and add to existing line!
699 699
 fi
700 700
 
701
+
701 702
 # Syslog
702 703
 # ------
703 704
 
... ...
@@ -992,6 +987,7 @@ if is_service_enabled nova && is_baremetal; then
992 992
     fi
993 993
 fi
994 994
 
995
+
995 996
 # Launch Services
996 997
 # ===============
997 998
 
... ...
@@ -1081,6 +1077,7 @@ if is_service_enabled heat; then
1081 1081
     start_heat
1082 1082
 fi
1083 1083
 
1084
+
1084 1085
 # Create account rc files
1085 1086
 # =======================
1086 1087
 
... ...
@@ -1191,6 +1188,7 @@ fi
1191 1191
 # Check the status of running services
1192 1192
 service_check
1193 1193
 
1194
+
1194 1195
 # Fin
1195 1196
 # ===
1196 1197
 
... ...
@@ -201,6 +201,10 @@ VOLUME_GROUP=${VOLUME_GROUP:-stack-volumes}
201 201
 VOLUME_NAME_PREFIX=${VOLUME_NAME_PREFIX:-volume-}
202 202
 INSTANCE_NAME_PREFIX=${INSTANCE_NAME_PREFIX:-instance-}
203 203
 
204
+# Set default port for nova-objectstore
205
+S3_SERVICE_PORT=${S3_SERVICE_PORT:-3333}
206
+
207
+# Common network names
204 208
 PRIVATE_NETWORK_NAME=${PRIVATE_NETWORK_NAME:-"private"}
205 209
 PUBLIC_NETWORK_NAME=${PUBLIC_NETWORK_NAME:-"nova"}
206 210