Browse code

cinder: configure dlm when this one is zookeeper

Previous this was set the zake, but that was revert to missing
dependencies issue and because zake is a test fixture and not somthing
to deploy.

This change configures the Cinder dlm with this one is zookeeper.
And it installs tooz and the extra dependencies needed for the
zookeeper driver.

To do it, this commit have to introduce a new method for package
installation: 'pip_install_gr_extras package extra1,extra2'.

Change-Id: Idca310c08e345db59840eb31434c6cb1f849fa70

Mehdi Abaakouk authored on 2016/12/02 00:11:17
Showing 3 changed files
... ...
@@ -69,6 +69,20 @@ function pip_install_gr {
69 69
     pip_install $clean_name
70 70
 }
71 71
 
72
+# Wrapper for ``pip install`` that only installs versions of libraries
73
+# from the global-requirements specification with extras.
74
+#
75
+# Uses globals ``REQUIREMENTS_DIR``
76
+#
77
+# pip_install_gr_extras packagename extra1,extra2,...
78
+function pip_install_gr_extras {
79
+    local name=$1
80
+    local extras=$2
81
+    local clean_name
82
+    clean_name=$(get_from_global_requirements $name)
83
+    pip_install $clean_name[$extras]
84
+}
85
+
72 86
 # Determine the python versions supported by a package
73 87
 function get_python_versions_for_package {
74 88
     local name=$1
... ...
@@ -373,6 +373,13 @@ function configure_cinder {
373 373
     iniset $CINDER_CONF DEFAULT os_privileged_user_password "$SERVICE_PASSWORD"
374 374
     iniset $CINDER_CONF DEFAULT os_privileged_user_tenant "$SERVICE_PROJECT_NAME"
375 375
     iniset $CINDER_CONF DEFAULT graceful_shutdown_timeout "$SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT"
376
+
377
+    # Set the backend url according to the configured dlm backend
378
+    if is_dlm_enabled; then
379
+        if [[ "$(dlm_backend)" == "zookeeper" ]]; then
380
+            iniset $CINDER_CONF coordination backend_url "zookeeper://${SERVICE_HOST}:2181"
381
+        fi
382
+    fi
376 383
 }
377 384
 
378 385
 # create_cinder_accounts() - Set up common required cinder accounts
... ...
@@ -91,6 +91,7 @@ function configure_dlm {
91 91
 # install_dlm() - Collect source and prepare
92 92
 function install_dlm {
93 93
     if is_dlm_enabled; then
94
+        pip_install_gr_extras tooz zookeeper
94 95
         if is_ubuntu; then
95 96
             install_package zookeeperd
96 97
         elif is_fedora; then