From 18225d92c0ef8d56dc7df3177eaed4860d97604b Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Sun, 14 Apr 2013 12:48:41 -0700 Subject: [PATCH] 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 --- lib/cinder | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/cinder b/lib/cinder index deace68277..71210eb9ef 100644 --- a/lib/cinder +++ b/lib/cinder @@ -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