Browse code

Use NOVA_BIN_DIR / SWIFT_BIN_DIR for binaries

Fix a few path issues where we didn't properly use NOVA_BIN_DIR /
SWIFT_BIN_DIR.

This is part of the effort to start using a virtualenv for openstack
services.

Change-Id: I6eb383db65cc902c67c43e5cb1a16a9716a914b2
Signed-off-by: Paul Belanger <pabelanger@redhat.com>

Paul Belanger authored on 2018/03/15 00:58:56
Showing 2 changed files
... ...
@@ -685,7 +685,7 @@ function init_nova_cells {
685 685
         $NOVA_BIN_DIR/nova-manage cell create --name=child --cell_type=child --username=$RABBIT_USERID --hostname=$RABBIT_HOST --port=5672 --password=$RABBIT_PASSWORD --virtual_host=child_cell --woffset=0 --wscale=1
686 686
 
687 687
         # Creates the single cells v2 cell for the child cell (v1) nova db.
688
-        nova-manage --config-file $NOVA_CELLS_CONF cell_v2 create_cell \
688
+        $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CELLS_CONF cell_v2 create_cell \
689 689
             --transport-url $(get_transport_url child_cell) --name 'cell1'
690 690
     fi
691 691
 }
... ...
@@ -729,7 +729,7 @@ function init_nova {
729 729
         # this needs to come after the api_db sync happens. We also want to run
730 730
         # this before the db sync below since that will migrate both the nova
731 731
         # and nova_cell0 databases.
732
-        nova-manage cell_v2 map_cell0 --database_connection `database_connection_url nova_cell0`
732
+        $NOVA_BIN_DIR/nova-manage cell_v2 map_cell0 --database_connection `database_connection_url nova_cell0`
733 733
 
734 734
         # (Re)create nova databases
735 735
         for i in $(seq 1 $NOVA_NUM_CELLS); do
... ...
@@ -750,7 +750,7 @@ function init_nova {
750 750
 
751 751
         # create the cell1 cell for the main nova db where the hosts live
752 752
         for i in $(seq 1 $NOVA_NUM_CELLS); do
753
-            nova-manage --config-file $NOVA_CONF --config-file $(conductor_conf $i) cell_v2 create_cell --name "cell$i"
753
+            $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF --config-file $(conductor_conf $i) cell_v2 create_cell --name "cell$i"
754 754
         done
755 755
     fi
756 756
 
... ...
@@ -1015,7 +1015,7 @@ function start_nova {
1015 1015
     if is_service_enabled n-api; then
1016 1016
         # dump the cell mapping to ensure life is good
1017 1017
         echo "Dumping cells_v2 mapping"
1018
-        nova-manage cell_v2 list_cells --verbose
1018
+        $NOVA_BIN_DIR/nova-manage cell_v2 list_cells --verbose
1019 1019
     fi
1020 1020
 }
1021 1021
 
... ...
@@ -37,6 +37,7 @@ fi
37 37
 
38 38
 # Set up default directories
39 39
 GITDIR["python-swiftclient"]=$DEST/python-swiftclient
40
+SWIFT_DIR=$DEST/swift
40 41
 
41 42
 # Swift virtual environment
42 43
 if [[ ${USE_VENV} = True ]]; then
... ...
@@ -46,8 +47,6 @@ else
46 46
     SWIFT_BIN_DIR=$(get_python_exec_prefix)
47 47
 fi
48 48
 
49
-
50
-SWIFT_DIR=$DEST/swift
51 49
 SWIFT_AUTH_CACHE_DIR=${SWIFT_AUTH_CACHE_DIR:-/var/cache/swift}
52 50
 SWIFT_APACHE_WSGI_DIR=${SWIFT_APACHE_WSGI_DIR:-/var/www/swift}
53 51
 SWIFT3_DIR=$DEST/swift3
... ...
@@ -341,7 +340,7 @@ function configure_swift {
341 341
     local user_group
342 342
 
343 343
     # Make sure to kill all swift processes first
344
-    swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true
344
+    $SWIFT_BIN_DIR/swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true
345 345
 
346 346
     sudo install -d -o ${STACK_USER} ${SWIFT_CONF_DIR}
347 347
     sudo install -d -o ${STACK_USER} ${SWIFT_CONF_DIR}/{object,container,account}-server
... ...
@@ -704,7 +703,7 @@ function create_swift_accounts {
704 704
 function init_swift {
705 705
     local node_number
706 706
     # Make sure to kill all swift processes first
707
-    swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true
707
+    $SWIFT_BIN_DIR/swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true
708 708
 
709 709
     # Forcibly re-create the backing filesystem
710 710
     create_swift_disk
... ...
@@ -715,9 +714,9 @@ function init_swift {
715 715
 
716 716
         rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz
717 717
 
718
-        swift-ring-builder object.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1
719
-        swift-ring-builder container.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1
720
-        swift-ring-builder account.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1
718
+        $SWIFT_BIN_DIR/swift-ring-builder object.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1
719
+        $SWIFT_BIN_DIR/swift-ring-builder container.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1
720
+        $SWIFT_BIN_DIR/swift-ring-builder account.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1
721 721
 
722 722
         # The ring will be created on each node, and because the order of
723 723
         # nodes is identical we can use a seed for rebalancing, making it
... ...
@@ -728,26 +727,26 @@ function init_swift {
728 728
             node_number=1
729 729
 
730 730
             for node in ${SWIFT_STORAGE_IPS}; do
731
-                swift-ring-builder object.builder add z${node_number}-${node}:${OBJECT_PORT_BASE}/sdb1 1
732
-                swift-ring-builder container.builder add z${node_number}-${node}:${CONTAINER_PORT_BASE}/sdb1 1
733
-                swift-ring-builder account.builder add z${node_number}-${node}:${ACCOUNT_PORT_BASE}/sdb1 1
731
+                $SWIFT_BIN_DIR/swift-ring-builder object.builder add z${node_number}-${node}:${OBJECT_PORT_BASE}/sdb1 1
732
+                $SWIFT_BIN_DIR/swift-ring-builder container.builder add z${node_number}-${node}:${CONTAINER_PORT_BASE}/sdb1 1
733
+                $SWIFT_BIN_DIR/swift-ring-builder account.builder add z${node_number}-${node}:${ACCOUNT_PORT_BASE}/sdb1 1
734 734
                 let "node_number=node_number+1"
735 735
             done
736 736
 
737 737
         else
738 738
 
739 739
             for node_number in ${SWIFT_REPLICAS_SEQ}; do
740
-                swift-ring-builder object.builder add z${node_number}-${SWIFT_SERVICE_LOCAL_HOST}:$(( OBJECT_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
741
-                swift-ring-builder container.builder add z${node_number}-${SWIFT_SERVICE_LOCAL_HOST}:$(( CONTAINER_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
742
-                swift-ring-builder account.builder add z${node_number}-${SWIFT_SERVICE_LOCAL_HOST}:$(( ACCOUNT_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
740
+                $SWIFT_BIN_DIR/swift-ring-builder object.builder add z${node_number}-${SWIFT_SERVICE_LOCAL_HOST}:$(( OBJECT_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
741
+                $SWIFT_BIN_DIR/swift-ring-builder container.builder add z${node_number}-${SWIFT_SERVICE_LOCAL_HOST}:$(( CONTAINER_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
742
+                $SWIFT_BIN_DIR/swift-ring-builder account.builder add z${node_number}-${SWIFT_SERVICE_LOCAL_HOST}:$(( ACCOUNT_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
743 743
             done
744 744
         fi
745 745
 
746 746
         # We use a seed for rebalancing. Doing this allows us to create
747 747
         # identical rings on multiple nodes if SWIFT_STORAGE_IPS is the same
748
-        swift-ring-builder object.builder rebalance 42
749
-        swift-ring-builder container.builder rebalance 42
750
-        swift-ring-builder account.builder rebalance 42
748
+        $SWIFT_BIN_DIR/swift-ring-builder object.builder rebalance 42
749
+        $SWIFT_BIN_DIR/swift-ring-builder container.builder rebalance 42
750
+        $SWIFT_BIN_DIR/swift-ring-builder account.builder rebalance 42
751 751
     } && popd >/dev/null
752 752
 
753 753
     # Create cache dir
... ...
@@ -803,7 +802,7 @@ function start_swift {
803 803
         # Apache should serve the "PACO" a.k.a "main" services
804 804
         restart_apache_server
805 805
         # The rest of the services should be started in backgroud
806
-        swift-init --run-dir=${SWIFT_DATA_DIR}/run rest start
806
+        $SWIFT_BIN_DIR/swift-init --run-dir=${SWIFT_DATA_DIR}/run rest start
807 807
         return 0
808 808
     fi
809 809
 
... ...
@@ -827,7 +826,7 @@ function start_swift {
827 827
         done
828 828
 
829 829
         if [[ "$SWIFT_START_ALL_SERVICES" == "True" ]]; then
830
-            swift-init --run-dir=${SWIFT_DATA_DIR}/run rest start
830
+            $SWIFT_BIN_DIR/swift-init --run-dir=${SWIFT_DATA_DIR}/run rest start
831 831
         else
832 832
             # The container-sync daemon is strictly needed to pass the container
833 833
             # sync Tempest tests.
... ...
@@ -835,8 +834,8 @@ function start_swift {
835 835
             run_process s-container-sync "$SWIFT_BIN_DIR/swift-container-sync ${SWIFT_CONF_DIR}/container-server/1.conf"
836 836
         fi
837 837
     else
838
-        swift-init --run-dir=${SWIFT_DATA_DIR}/run all restart || true
839
-        swift-init --run-dir=${SWIFT_DATA_DIR}/run proxy stop || true
838
+        $SWIFT_BIN_DIR/swift-init --run-dir=${SWIFT_DATA_DIR}/run all restart || true
839
+        $SWIFT_BIN_DIR/swift-init --run-dir=${SWIFT_DATA_DIR}/run proxy stop || true
840 840
     fi
841 841
 
842 842
     if is_service_enabled tls-proxy; then
... ...
@@ -863,12 +862,12 @@ function stop_swift {
863 863
     local type
864 864
 
865 865
     if [ "$SWIFT_USE_MOD_WSGI" == "True" ]; then
866
-        swift-init --run-dir=${SWIFT_DATA_DIR}/run rest stop && return 0
866
+        $SWIFT_BIN_DIR/swift-init --run-dir=${SWIFT_DATA_DIR}/run rest stop && return 0
867 867
     fi
868 868
 
869 869
     # screen normally killed by ``unstack.sh``
870
-    if type -p swift-init >/dev/null; then
871
-        swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true
870
+    if type -p $SWIFT_BIN_DIR/swift-init >/dev/null; then
871
+        $SWIFT_BIN_DIR/swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true
872 872
     fi
873 873
     # Dump all of the servers
874 874
     # Maintain the iteration as stop_process() has some desirable side-effects