Browse code

Add is_service_enabled function.

Add a function to detect if one of the feature/server is enabled.
Some catch all for nova glance quantum

Thanks for dtroyer reviews and suggestions.

Change-Id: I082be08ebad666de16f0710627696516b3b3c48b

Chmouel Boudjnah authored on 2012/02/16 19:16:52
Showing 1 changed files
... ...
@@ -264,6 +264,27 @@ function read_password {
264 264
     set -o xtrace
265 265
 }
266 266
 
267
+# This function will check if the service(s) specified in argument is
268
+# enabled by the user in ENABLED_SERVICES.
269
+#
270
+# If there is multiple services specified as argument it will act as a
271
+# boolean OR or if any of the services specified on the command line
272
+# return true.
273
+#
274
+# There is a special cases for some 'catch-all' services :
275
+#      nova would catch if any service enabled start by n-
276
+#    glance would catch if any service enabled start by g-
277
+#   quantum would catch if any service enabled start by q-
278
+function is_service_enabled() {
279
+    services=$@
280
+    for service in ${services}; do
281
+        [[ ,${ENABLED_SERVICES}, =~ ,${service}, ]] && return 0
282
+        [[ ${service} == "nova" && ${ENABLED_SERVICES} =~ "n-" ]] && return 0
283
+        [[ ${service} == "glance" && ${ENABLED_SERVICES} =~ "g-" ]] && return 0
284
+        [[ ${service} == "quantum" && ${ENABLED_SERVICES} =~ "q-" ]] && return 0
285
+    done
286
+    return 1
287
+}
267 288
 
268 289
 # Nova Network Configuration
269 290
 # --------------------------
... ...
@@ -384,7 +405,7 @@ SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-1000000}
384 384
 SWIFT_PARTITION_POWER_SIZE=${SWIFT_PARTITION_POWER_SIZE:-9}
385 385
 
386 386
 # We only ask for Swift Hash if we have enabled swift service.
387
-if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
387
+if is_service_enabled swift; then
388 388
     # SWIFT_HASH is a random unique string for a swift cluster that
389 389
     # can never change.
390 390
     read_password SWIFT_HASH "ENTER A RANDOM SWIFT HASH."
... ...
@@ -537,44 +558,40 @@ git_clone $KEYSTONECLIENT_REPO $KEYSTONECLIENT_DIR $KEYSTONECLIENT_BRANCH
537 537
 git_clone $NOVACLIENT_REPO $NOVACLIENT_DIR $NOVACLIENT_BRANCH
538 538
 
539 539
 # glance, swift middleware and nova api needs keystone middleware
540
-if [[ "$ENABLED_SERVICES" =~ "key" ||
541
-      "$ENABLED_SERVICES" =~ "g-api" ||
542
-      "$ENABLED_SERVICES" =~ "n-api" ||
543
-      "$ENABLED_SERVICES" =~ "swift" ]]; then
540
+if is_service_enabled key g-api n-api swift; then
544 541
     # unified auth system (manages accounts/tokens)
545 542
     git_clone $KEYSTONE_REPO $KEYSTONE_DIR $KEYSTONE_BRANCH
546 543
 fi
547
-if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
544
+if is_service_enabled swift; then
548 545
     # storage service
549 546
     git_clone $SWIFT_REPO $SWIFT_DIR $SWIFT_BRANCH
550 547
     # swift + keystone middleware
551 548
     git_clone $SWIFT_KEYSTONE_REPO $SWIFT_KEYSTONE_DIR $SWIFT_KEYSTONE_BRANCH
552 549
 fi
553
-if [[ "$ENABLED_SERVICES" =~ "g-api" ||
554
-      "$ENABLED_SERVICES" =~ "n-api" ]]; then
550
+if is_service_enabled g-api n-api; then
555 551
     # image catalog service
556 552
     git_clone $GLANCE_REPO $GLANCE_DIR $GLANCE_BRANCH
557 553
 fi
558
-if [[ "$ENABLED_SERVICES" =~ "n-novnc" ]]; then
554
+if is_service_enabled n-novnc; then
559 555
     # a websockets/html5 or flash powered VNC console for vm instances
560 556
     git_clone $NOVNC_REPO $NOVNC_DIR $NOVNC_BRANCH
561 557
 fi
562
-if [[ "$ENABLED_SERVICES" =~ "horizon" ]]; then
558
+if is_service_enabled horizon; then
563 559
     # django powered web control panel for openstack
564 560
     git_clone $HORIZON_REPO $HORIZON_DIR $HORIZON_BRANCH $HORIZON_TAG
565 561
 fi
566
-if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
562
+if is_service_enabled q-svc; then
567 563
     # quantum
568 564
     git_clone $QUANTUM_REPO $QUANTUM_DIR $QUANTUM_BRANCH
569 565
     git_clone $QUANTUM_CLIENT_REPO $QUANTUM_CLIENT_DIR $QUANTUM_CLIENT_BRANCH
570 566
 fi
571 567
 
572
-if [[ "$ENABLED_SERVICES" =~ "m-svc" ]]; then
568
+if is_service_enabled m-svc; then
573 569
     # melange
574 570
     git_clone $MELANGE_REPO $MELANGE_DIR $MELANGE_BRANCH
575 571
 fi
576 572
 
577
-if [[ "$ENABLED_SERVICES" =~ "melange" ]]; then
573
+if is_service_enabled melange; then
578 574
     git_clone $MELANGECLIENT_REPO $MELANGECLIENT_DIR $MELANGECLIENT_BRANCH
579 575
 fi
580 576
 
... ...
@@ -586,32 +603,28 @@ fi
586 586
 # allowing ``import nova`` or ``import glance.client``
587 587
 cd $KEYSTONECLIENT_DIR; sudo python setup.py develop
588 588
 cd $NOVACLIENT_DIR; sudo python setup.py develop
589
-if [[ "$ENABLED_SERVICES" =~ "key" ||
590
-      "$ENABLED_SERVICES" =~ "g-api" ||
591
-      "$ENABLED_SERVICES" =~ "n-api" ||
592
-      "$ENABLED_SERVICES" =~ "swift" ]]; then
589
+if is_service_enabled key g-api n-api swift; then
593 590
     cd $KEYSTONE_DIR; sudo python setup.py develop
594 591
 fi
595
-if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
592
+if is_service_enabled swift; then
596 593
     cd $SWIFT_DIR; sudo python setup.py develop
597 594
     cd $SWIFT_KEYSTONE_DIR; sudo python setup.py develop
598 595
 fi
599
-if [[ "$ENABLED_SERVICES" =~ "g-api" ||
600
-      "$ENABLED_SERVICES" =~ "n-api" ]]; then
596
+if is_service_enabled g-api n-api; then
601 597
     cd $GLANCE_DIR; sudo python setup.py develop
602 598
 fi
603 599
 cd $NOVA_DIR; sudo python setup.py develop
604
-if [[ "$ENABLED_SERVICES" =~ "horizon" ]]; then
600
+if is_service_enabled horizon; then
605 601
     cd $HORIZON_DIR/horizon; sudo python setup.py develop
606 602
     cd $HORIZON_DIR/openstack-dashboard; sudo python setup.py develop
607 603
 fi
608
-if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
604
+if is_service_enabled q-svc; then
609 605
     cd $QUANTUM_DIR; sudo python setup.py develop
610 606
 fi
611
-if [[ "$ENABLED_SERVICES" =~ "m-svc" ]]; then
607
+if is_service_enabled m-svc; then
612 608
     cd $MELANGE_DIR; sudo python setup.py develop
613 609
 fi
614
-if [[ "$ENABLED_SERVICES" =~ "melange" ]]; then
610
+if is_service_enabled melange; then
615 611
     cd $MELANGECLIENT_DIR; sudo python setup.py develop
616 612
 fi
617 613
 
... ...
@@ -640,7 +653,7 @@ fi
640 640
 # Rabbit
641 641
 # ---------
642 642
 
643
-if [[ "$ENABLED_SERVICES" =~ "rabbit" ]]; then
643
+if is_service_enabled rabbit; then
644 644
     # Install and start rabbitmq-server
645 645
     # the temp file is necessary due to LP: #878600
646 646
     tfile=$(mktemp)
... ...
@@ -654,7 +667,7 @@ fi
654 654
 # Mysql
655 655
 # ---------
656 656
 
657
-if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then
657
+if is_service_enabled mysql; then
658 658
 
659 659
     # Seed configuration with mysql password so that apt-get install doesn't
660 660
     # prompt us for a password upon install.
... ...
@@ -693,7 +706,7 @@ fi
693 693
 
694 694
 # Setup the django horizon application to serve via apache/wsgi
695 695
 
696
-if [[ "$ENABLED_SERVICES" =~ "horizon" ]]; then
696
+if is_service_enabled horizon; then
697 697
 
698 698
     # Install apache2, which is NOPRIME'd
699 699
     apt_get install apache2 libapache2-mod-wsgi
... ...
@@ -710,7 +723,7 @@ if [[ "$ENABLED_SERVICES" =~ "horizon" ]]; then
710 710
     cp $FILES/horizon_settings.py $local_settings
711 711
 
712 712
     # Enable quantum in dashboard, if requested
713
-    if [[ "$ENABLED_SERVICES" =~ "quantum" ]]; then
713
+    if is_service_enabled quantum; then
714 714
         sudo sed -e "s,QUANTUM_ENABLED = False,QUANTUM_ENABLED = True,g" -i $local_settings
715 715
     fi
716 716
 
... ...
@@ -736,7 +749,7 @@ fi
736 736
 # Glance
737 737
 # ------
738 738
 
739
-if [[ "$ENABLED_SERVICES" =~ "g-reg" ]]; then
739
+if is_service_enabled g-reg; then
740 740
     GLANCE_IMAGE_DIR=$DEST/glance/images
741 741
     # Delete existing images
742 742
     rm -rf $GLANCE_IMAGE_DIR
... ...
@@ -801,7 +814,7 @@ if [[ ! -d $NOVA_CONF ]]; then
801 801
 fi
802 802
 sudo chown `whoami` $NOVA_CONF
803 803
 
804
-if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
804
+if is_service_enabled n-api; then
805 805
     # We are going to use a sample http middleware configuration based on the
806 806
     # one from the keystone project to launch nova.  This paste config adds
807 807
     # the configuration required for nova to validate keystone tokens.
... ...
@@ -834,7 +847,7 @@ function clean_iptables() {
834 834
     sudo iptables -S -v -t nat | sed "s/-c [0-9]* [0-9]* //g" | grep "nova" |  grep "\-N" | sed "s/-N/-X/g" | awk '{print "sudo iptables -t nat",$0}' | bash
835 835
 }
836 836
 
837
-if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then
837
+if is_service_enabled n-cpu; then
838 838
 
839 839
     # Virtualization Configuration
840 840
     # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... ...
@@ -915,7 +928,7 @@ if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then
915 915
     sudo rm -rf $NOVA_DIR/instances/*
916 916
 fi
917 917
 
918
-if [[ "$ENABLED_SERVICES" =~ "n-net" ]]; then
918
+if is_service_enabled n-net; then
919 919
     # Delete traces of nova networks from prior runs
920 920
     sudo killall dnsmasq || true
921 921
     clean_iptables
... ...
@@ -924,7 +937,7 @@ if [[ "$ENABLED_SERVICES" =~ "n-net" ]]; then
924 924
 fi
925 925
 
926 926
 # Storage Service
927
-if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
927
+if is_service_enabled swift; then
928 928
     # We first do a bit of setup by creating the directories and
929 929
     # changing the permissions so we can run it as our user.
930 930
 
... ...
@@ -983,7 +996,7 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
983 983
    # By default Swift will be installed with the tempauth middleware
984 984
    # which has some default username and password if you have
985 985
    # configured keystone it will checkout the directory.
986
-   if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
986
+   if is_service_enabled key; then
987 987
        swift_auth_server=keystone
988 988
 
989 989
        # We install the memcache server as this is will be used by the
... ...
@@ -1060,7 +1073,7 @@ fi
1060 1060
 # Volume Service
1061 1061
 # --------------
1062 1062
 
1063
-if [[ "$ENABLED_SERVICES" =~ "n-vol" ]]; then
1063
+if is_service_enabled n-vol; then
1064 1064
     #
1065 1065
     # Configure a default volume group called 'nova-volumes' for the nova-volume
1066 1066
     # service if it does not yet exist.  If you don't wish to use a file backed
... ...
@@ -1111,21 +1124,21 @@ add_nova_flag "--allow_admin_api"
1111 1111
 add_nova_flag "--scheduler_driver=$SCHEDULER"
1112 1112
 add_nova_flag "--dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf"
1113 1113
 add_nova_flag "--fixed_range=$FIXED_RANGE"
1114
-if [[ "$ENABLED_SERVICES" =~ "n-obj" ]]; then
1114
+if is_service_enabled n-obj; then
1115 1115
     add_nova_flag "--s3_host=$SERVICE_HOST"
1116 1116
 fi
1117
-if [[ "$ENABLED_SERVICES" =~ "quantum" ]]; then
1117
+if is_service_enabled quantum; then
1118 1118
     add_nova_flag "--network_manager=nova.network.quantum.manager.QuantumManager"
1119 1119
     add_nova_flag "--quantum_connection_host=$Q_HOST"
1120 1120
     add_nova_flag "--quantum_connection_port=$Q_PORT"
1121 1121
 
1122
-    if [[ "$ENABLED_SERVICES" =~ "melange" ]]; then
1122
+    if is_service_enabled melange; then
1123 1123
         add_nova_flag "--quantum_ipam_lib=nova.network.quantum.melange_ipam_lib"
1124 1124
         add_nova_flag "--use_melange_mac_generation"
1125 1125
         add_nova_flag "--melange_host=$M_HOST"
1126 1126
         add_nova_flag "--melange_port=$M_PORT"
1127 1127
     fi
1128
-    if [[ "$ENABLED_SERVICES" =~ "q-svc" && "$Q_PLUGIN" = "openvswitch" ]]; then
1128
+    if is_service_enabled q-svc && [[ "$Q_PLUGIN" = "openvswitch" ]]; then
1129 1129
         add_nova_flag "--libvirt_vif_type=ethernet"
1130 1130
         add_nova_flag "--libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtOpenVswitchDriver"
1131 1131
         add_nova_flag "--linuxnet_interface_driver=nova.network.linux_net.LinuxOVSInterfaceDriver"
... ...
@@ -1134,7 +1147,7 @@ if [[ "$ENABLED_SERVICES" =~ "quantum" ]]; then
1134 1134
 else
1135 1135
     add_nova_flag "--network_manager=nova.network.manager.$NET_MAN"
1136 1136
 fi
1137
-if [[ "$ENABLED_SERVICES" =~ "n-vol" ]]; then
1137
+if is_service_enabled n-vol; then
1138 1138
     add_nova_flag "--volume_group=$VOLUME_GROUP"
1139 1139
     add_nova_flag "--volume_name_template=${VOLUME_NAME_PREFIX}%08x"
1140 1140
     # oneiric no longer supports ietadm
... ...
@@ -1149,7 +1162,7 @@ add_nova_flag "--libvirt_type=$LIBVIRT_TYPE"
1149 1149
 add_nova_flag "--instance_name_template=${INSTANCE_NAME_PREFIX}%08x"
1150 1150
 # All nova-compute workers need to know the vnc configuration options
1151 1151
 # These settings don't hurt anything if n-xvnc and n-novnc are disabled
1152
-if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then
1152
+if is_service_enabled n-cpu; then
1153 1153
     NOVNCPROXY_URL=${NOVNCPROXY_URL:-"http://$SERVICE_HOST:6080/vnc_auto.html"}
1154 1154
     add_nova_flag "--novncproxy_base_url=$NOVNCPROXY_URL"
1155 1155
     XVPVNCPROXY_URL=${XVPVNCPROXY_URL:-"http://$SERVICE_HOST:6081/console"}
... ...
@@ -1221,7 +1234,7 @@ fi
1221 1221
 # All nova components talk to a central database.  We will need to do this step
1222 1222
 # only once for an entire cluster.
1223 1223
 
1224
-if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then
1224
+if is_service_enabled mysql; then
1225 1225
     # (re)create nova database
1226 1226
     mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS nova;'
1227 1227
     mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE nova;'
... ...
@@ -1241,7 +1254,7 @@ fi
1241 1241
 # our screen helper to launch a service in a hidden named screen
1242 1242
 function screen_it {
1243 1243
     NL=`echo -ne '\015'`
1244
-    if [[ "$ENABLED_SERVICES" =~ "$1" ]]; then
1244
+    if is_service_enabled $1; then
1245 1245
         screen -S stack -X screen -t $1
1246 1246
         # sleep to allow bash to be ready to be send the command - we are
1247 1247
         # creating a new window in screen and then sends characters, so if
... ...
@@ -1258,12 +1271,12 @@ sleep 1
1258 1258
 screen -r stack -X hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%< %= %H"
1259 1259
 
1260 1260
 # launch the glance registry service
1261
-if [[ "$ENABLED_SERVICES" =~ "g-reg" ]]; then
1261
+if is_service_enabled g-reg; then
1262 1262
     screen_it g-reg "cd $GLANCE_DIR; bin/glance-registry --config-file=etc/glance-registry.conf"
1263 1263
 fi
1264 1264
 
1265 1265
 # launch the glance api and wait for it to answer before continuing
1266
-if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then
1266
+if is_service_enabled g-api; then
1267 1267
     screen_it g-api "cd $GLANCE_DIR; bin/glance-api --config-file=etc/glance-api.conf"
1268 1268
     echo "Waiting for g-api ($GLANCE_HOSTPORT) to start..."
1269 1269
     if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://$GLANCE_HOSTPORT; do sleep 1; done"; then
... ...
@@ -1272,7 +1285,7 @@ if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then
1272 1272
     fi
1273 1273
 fi
1274 1274
 
1275
-if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
1275
+if is_service_enabled key; then
1276 1276
     # (re)create keystone database
1277 1277
     mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS keystone;'
1278 1278
     mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE keystone;'
... ...
@@ -1301,7 +1314,7 @@ if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
1301 1301
 fi
1302 1302
 
1303 1303
 # launch the keystone and wait for it to answer before continuing
1304
-if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
1304
+if is_service_enabled key; then
1305 1305
     screen_it key "cd $KEYSTONE_DIR && $KEYSTONE_DIR/bin/keystone-all --config-file $KEYSTONE_CONF $KEYSTONE_LOG_CONFIG -d --debug"
1306 1306
     echo "Waiting for keystone to start..."
1307 1307
     if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0/; do sleep 1; done"; then
... ...
@@ -1321,7 +1334,7 @@ fi
1321 1321
 
1322 1322
 
1323 1323
 # launch the nova-api and wait for it to answer before continuing
1324
-if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
1324
+if is_service_enabled n-api; then
1325 1325
     screen_it n-api "cd $NOVA_DIR && $NOVA_DIR/bin/nova-api"
1326 1326
     echo "Waiting for nova-api to start..."
1327 1327
     if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://127.0.0.1:8774; do sleep 1; done"; then
... ...
@@ -1331,13 +1344,13 @@ if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
1331 1331
 fi
1332 1332
 
1333 1333
 # Quantum service
1334
-if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
1334
+if is_service_enabled q-svc; then
1335 1335
     if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
1336 1336
         # Install deps
1337 1337
         # FIXME add to files/apts/quantum, but don't install if not needed!
1338 1338
         apt_get install openvswitch-switch openvswitch-datapath-dkms
1339 1339
         # Create database for the plugin/agent
1340
-        if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then
1340
+        if is_service_enabled mysql; then
1341 1341
             mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS ovs_quantum;'
1342 1342
             mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE IF NOT EXISTS ovs_quantum;'
1343 1343
         else
... ...
@@ -1352,7 +1365,7 @@ if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
1352 1352
 fi
1353 1353
 
1354 1354
 # Quantum agent (for compute nodes)
1355
-if [[ "$ENABLED_SERVICES" =~ "q-agt" ]]; then
1355
+if is_service_enabled q-agt; then
1356 1356
     if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
1357 1357
         # Set up integration bridge
1358 1358
         OVS_BRIDGE=${OVS_BRIDGE:-br-int}
... ...
@@ -1369,8 +1382,8 @@ if [[ "$ENABLED_SERVICES" =~ "q-agt" ]]; then
1369 1369
 fi
1370 1370
 
1371 1371
 # Melange service
1372
-if [[ "$ENABLED_SERVICES" =~ "m-svc" ]]; then
1373
-    if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then
1372
+if is_service_enabled m-svc; then
1373
+    if is_service_enabled mysql; then
1374 1374
         mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS melange;'
1375 1375
         mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE melange;'
1376 1376
     else
... ...
@@ -1392,11 +1405,11 @@ fi
1392 1392
 
1393 1393
 # If we're using Quantum (i.e. q-svc is enabled), network creation has to
1394 1394
 # happen after we've started the Quantum service.
1395
-if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then
1395
+if is_service_enabled mysql; then
1396 1396
     # create a small network
1397 1397
     $NOVA_DIR/bin/nova-manage network create private $FIXED_RANGE 1 $FIXED_NETWORK_SIZE
1398 1398
 
1399
-    if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
1399
+    if is_service_enabled q-svc; then
1400 1400
         echo "Not creating floating IPs (not supported by QuantumManager)"
1401 1401
     else
1402 1402
         # create some floating ips
... ...
@@ -1419,16 +1432,16 @@ screen_it n-obj "cd $NOVA_DIR && $NOVA_DIR/bin/nova-objectstore"
1419 1419
 screen_it n-vol "cd $NOVA_DIR && $NOVA_DIR/bin/nova-volume"
1420 1420
 screen_it n-net "cd $NOVA_DIR && $NOVA_DIR/bin/nova-network"
1421 1421
 screen_it n-sch "cd $NOVA_DIR && $NOVA_DIR/bin/nova-scheduler"
1422
-if [[ "$ENABLED_SERVICES" =~ "n-novnc" ]]; then
1422
+if is_service_enabled n-novnc; then
1423 1423
     screen_it n-novnc "cd $NOVNC_DIR && ./utils/nova-novncproxy --flagfile $NOVA_DIR/bin/nova.conf --web ."
1424 1424
 fi
1425
-if [[ "$ENABLED_SERVICES" =~ "n-xvnc" ]]; then
1425
+if is_service_enabled n-xvnc; then
1426 1426
     screen_it n-xvnc "cd $NOVA_DIR && ./bin/nova-xvpvncproxy --flagfile $NOVA_DIR/bin/nova.conf"
1427 1427
 fi
1428
-if [[ "$ENABLED_SERVICES" =~ "n-cauth" ]]; then
1428
+if is_service_enabled n-cauth; then
1429 1429
     screen_it n-cauth "cd $NOVA_DIR && ./bin/nova-consoleauth"
1430 1430
 fi
1431
-if [[ "$ENABLED_SERVICES" =~ "horizon" ]]; then
1431
+if is_service_enabled horizon; then
1432 1432
     screen_it horizon "cd $HORIZON_DIR && sudo tail -f /var/log/apache2/error.log"
1433 1433
 fi
1434 1434
 
... ...
@@ -1448,7 +1461,7 @@ fi
1448 1448
 #  * **natty**: http://uec-images.ubuntu.com/natty/current/natty-server-cloudimg-amd64.tar.gz
1449 1449
 #  * **oneiric**: http://uec-images.ubuntu.com/oneiric/current/oneiric-server-cloudimg-amd64.tar.gz
1450 1450
 
1451
-if [[ "$ENABLED_SERVICES" =~ "g-reg" ]]; then
1451
+if is_service_enabled g-reg; then
1452 1452
     # Create a directory for the downloaded image tarballs.
1453 1453
     mkdir -p $FILES/images
1454 1454
 
... ...
@@ -1539,12 +1552,12 @@ echo ""
1539 1539
 
1540 1540
 # If you installed the horizon on this server, then you should be able
1541 1541
 # to access the site using your browser.
1542
-if [[ "$ENABLED_SERVICES" =~ "horizon" ]]; then
1542
+if is_service_enabled horizon; then
1543 1543
     echo "horizon is now available at http://$SERVICE_HOST/"
1544 1544
 fi
1545 1545
 
1546 1546
 # If keystone is present, you can point nova cli to this server
1547
-if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
1547
+if is_service_enabled key; then
1548 1548
     echo "keystone is serving at $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0/"
1549 1549
     echo "examples on using novaclient command line is in exercise.sh"
1550 1550
     echo "the default users are: admin and demo"