Browse code

rework etcd3 install to be like other devstack services

This separates out the install phase early from the start phase to
make this mirror other services in devstack.

Depends-On: I4124dc7e3fd3b4d973979da85209ec991c0f8c4b

Change-Id: I76f8740448b25a48869ee80006e826baa6cafc2b

Sean Dague authored on 2017/06/19 21:27:16
Showing 3 changed files
... ...
@@ -41,13 +41,6 @@ fi
41 41
 
42 42
 # start_etcd3() - Starts to run the etcd process
43 43
 function start_etcd3 {
44
-    # Don't install in sub nodes (multinode scenario)
45
-    if [ "$SERVICE_HOST" != "$HOST_IP" ]; then
46
-        return
47
-    fi
48
-
49
-    _install_etcd
50
-
51 44
     local cmd="$ETCD_BIN_DIR/etcd"
52 45
     cmd+=" --name $HOSTNAME --data-dir $ETCD_DATA_DIR"
53 46
     cmd+=" --initial-cluster-state new --initial-cluster-token etcd-cluster-01"
... ...
@@ -96,7 +89,7 @@ function cleanup_etcd3 {
96 96
     sudo rm -rf $ETCD_DATA_DIR
97 97
 }
98 98
 
99
-function _install_etcd {
99
+function install_etcd3 {
100 100
     echo "Installing etcd"
101 101
 
102 102
     # Make sure etcd3 downloads the correct architecture
... ...
@@ -115,10 +108,6 @@ function _install_etcd {
115 115
 
116 116
     ETCD_NAME=etcd-$ETCD_VERSION-linux-$ETCD_ARCH
117 117
 
118
-    # Install the libraries needed. Note: tooz for example does not have a hard dependency on these libraries
119
-    pip_install etcd3
120
-    pip_install etcd3gw
121
-
122 118
     # Create the necessary directories
123 119
     sudo mkdir -p $ETCD_BIN_DIR
124 120
     sudo mkdir -p $ETCD_DATA_DIR
... ...
@@ -109,7 +109,14 @@ function install_oslo {
109 109
     _do_install_oslo_lib "stevedore"
110 110
     _do_install_oslo_lib "taskflow"
111 111
     _do_install_oslo_lib "tooz"
112
+    # installation of additional libraries
113
+    #
114
+    # os-traits for nova
112 115
     _do_install_oslo_lib "os-traits"
116
+
117
+    # etcd (because tooz does not have a hard dependency on these)
118
+    pip_install etcd3
119
+    pip_install etcd3gw
113 120
 }
114 121
 
115 122
 # Restore xtrace
... ...
@@ -813,6 +813,10 @@ if is_service_enabled neutron; then
813 813
     install_neutron_agent_packages
814 814
 fi
815 815
 
816
+if is_service_enabled etcd3; then
817
+    install_etcd3
818
+fi
819
+
816 820
 # Check Out and Install Source
817 821
 # ----------------------------
818 822