Browse code

Make sure tgt is using config.d approach

Fixes bug 1045358.

On ubuntu Oneiric, the tgt configuration was not using the config.d
approach. tgt was unable to find the config files, so no volumes could
be created. This fix makes sure, that the config.d directory is there,
and the configuration includes files from there.

Was Cinder only, added same fix for Nova volumes

Change-Id: I6752cb628dd22e91e640f0f584fafefa4cd6d0f1

Mate Lakat authored on 2012/09/03 23:45:53
Showing 2 changed files
... ...
@@ -189,10 +189,19 @@ function install_cinder() {
189 189
     git_clone $CINDERCLIENT_REPO $CINDERCLIENT_DIR $CINDERCLIENT_BRANCH
190 190
 }
191 191
 
192
+# apply config.d approach (e.g. Oneiric does not have this)
193
+function _configure_tgt_for_config_d() {
194
+    if [[ ! -d /etc/tgt/conf.d/ ]]; then
195
+        sudo mkdir /etc/tgt/conf.d
196
+        echo "include /etc/tgt/conf.d/*.conf" | sudo tee -a /etc/tgt/targets.conf
197
+    fi
198
+}
199
+
192 200
 # start_cinder() - Start running processes, including screen
193 201
 function start_cinder() {
194 202
     if is_service_enabled c-vol; then
195 203
         if [[ "$os_PACKAGE" = "deb" ]]; then
204
+            _configure_tgt_for_config_d
196 205
             if [[ ! -f /etc/tgt/conf.d/cinder.conf ]]; then
197 206
                echo "include $CINDER_DIR/volumes/*" | sudo tee /etc/tgt/conf.d/cinder.conf
198 207
             fi
... ...
@@ -5,6 +5,7 @@
5 5
 # - functions
6 6
 # - KEYSTONE_AUTH_* must be defined
7 7
 # SERVICE_{TENANT_NAME|PASSWORD} must be defined
8
+# _configure_tgt_for_config_d() from lib/cinder
8 9
 
9 10
 # stack.sh
10 11
 # ---------
... ...
@@ -94,6 +95,7 @@ function install_nvol() {
94 94
 function start_nvol() {
95 95
     # Setup the tgt configuration file
96 96
     if [[ ! -f /etc/tgt/conf.d/nova.conf ]]; then
97
+        _configure_tgt_for_config_d
97 98
        sudo mkdir -p /etc/tgt/conf.d
98 99
        echo "include $NOVA_DIR/volumes/*" | sudo tee /etc/tgt/conf.d/nova.conf
99 100
     fi