Name the tgt/conf.d enties based on the vg name
On one system multiple volume and volume manger could be installed and
needs dedicated tgt config entries.
cinder-volumes, stack-volumes, nova-volumes are the default volume group
names.
/etc/tgt/conf.d/ files should be named based on the volume-group name.
The vg name is uniq on one system.
In devstack case the stack.conf is usable.
Changes:
* Rename conf.d/cinder.conf to conf.d/stack.conf
* Handle conf.d similary on all distribution
Change-Id: I856cdf4a21a414d2940d8f9d8b0b0368b1fad887
diff --git a/lib/cinder b/lib/cinder
index ce160bf..039c5cb 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -9,12 +9,12 @@
# stack.sh
# ---------
-# install_XXX
-# configure_XXX
-# init_XXX
-# start_XXX
-# stop_XXX
-# cleanup_XXX
+# install_cinder
+# configure_cinder
+# init_cinder
+# start_cinder
+# stop_cinder
+# cleanup_cinder
# Save trace setting
XTRACE=$(set +o | grep xtrace)
@@ -229,7 +229,7 @@
# apply config.d approach (e.g. Oneiric does not have this)
function _configure_tgt_for_config_d() {
if [[ ! -d /etc/tgt/conf.d/ ]]; then
- sudo mkdir /etc/tgt/conf.d
+ sudo mkdir -p /etc/tgt/conf.d
echo "include /etc/tgt/conf.d/*.conf" | sudo tee -a /etc/tgt/targets.conf
fi
}
@@ -237,11 +237,11 @@
# start_cinder() - Start running processes, including screen
function start_cinder() {
if is_service_enabled c-vol; then
+ _configure_tgt_for_config_d
+ if [[ ! -f /etc/tgt/conf.d/stack.conf ]]; then
+ echo "include $CINDER_STATE_PATH/volumes/*" | sudo tee /etc/tgt/conf.d/stack.conf
+ fi
if is_ubuntu; then
- _configure_tgt_for_config_d
- if [[ ! -f /etc/tgt/conf.d/cinder.conf ]]; then
- echo "include $CINDER_STATE_PATH/volumes/*" | sudo tee /etc/tgt/conf.d/cinder.conf
- fi
# tgt in oneiric doesn't restart properly if tgtd isn't running
# do it in two steps
sudo stop tgt || true