link /etc/tgt/stack.d to cinder volumes directory

This creates /etc/tgt/stack.d as a symlink to the cinder volumes
directory and includes it in /etc/tgt/targets.conf in a similar way
to /etc/tgt/conf.d

targets.conf only gets appended to when the symlink is created.
Any old /etc/tgt/conf.d/stack.conf is deleted

Change-Id: Ifb6412f6860ceb28b724644fb9b618638f552102
Fixes: bug #1072121
This commit is contained in:
Steve Baker 2013-04-14 12:48:41 -07:00
parent c4193b22f3
commit 18225d92c0

View File

@ -373,21 +373,20 @@ function install_cinderclient() {
setup_develop $CINDERCLIENT_DIR
}
# apply config.d approach (e.g. Oneiric does not have this)
# apply config.d approach for cinder volumes directory
function _configure_tgt_for_config_d() {
if [[ ! -d /etc/tgt/conf.d/ ]]; then
sudo mkdir -p /etc/tgt/conf.d
echo "include /etc/tgt/conf.d/*.conf" | sudo tee -a /etc/tgt/targets.conf
if [[ ! -d /etc/tgt/stack.d/ ]]; then
sudo ln -sf $CINDER_STATE_PATH/volumes /etc/tgt/stack.d
echo "include /etc/tgt/stack.d/*" | sudo tee -a /etc/tgt/targets.conf
fi
}
# start_cinder() - Start running processes, including screen
function start_cinder() {
if is_service_enabled c-vol; then
# Delete any old stack.conf
sudo rm -f /etc/tgt/conf.d/stack.conf
_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
# tgt in oneiric doesn't restart properly if tgtd isn't running
# do it in two steps