From 3f603d93c87ad200d61ec3827bb847cccd699929 Mon Sep 17 00:00:00 2001 From: Chuck Short Date: Sat, 28 Jul 2012 13:28:33 -0500 Subject: [PATCH] Setup tgtd configuration files Setup devstack to use tgtd confiuration files. Change-Id: Icb2a1a0c5ca517604f9a3930e7c89e3be9a36b0c Signed-off-by: Chuck Short --- lib/cinder | 5 +++++ stack.sh | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/cinder b/lib/cinder index 0e42600b1a..49ad4afe04 100644 --- a/lib/cinder +++ b/lib/cinder @@ -142,6 +142,8 @@ function init_cinder() { if ! sudo vgs $VOLUME_GROUP; then sudo vgcreate $VOLUME_GROUP $DEV; fi fi + mkdir -p $CINDER_DIR/volumes + if sudo vgs $VOLUME_GROUP; then if [[ "$os_PACKAGE" = "rpm" ]]; then # RPM doesn't start the service @@ -171,6 +173,9 @@ function install_cinder() { function start_cinder() { if is_service_enabled c-vol; then if [[ "$os_PACKAGE" = "deb" ]]; then + if [[ ! -f /etc/tgt/conf.d/cinder.conf ]]; then + echo "include $CINDER_DIR/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 diff --git a/stack.sh b/stack.sh index 0fbb957ac8..5ca52e4e04 100755 --- a/stack.sh +++ b/stack.sh @@ -1699,6 +1699,9 @@ elif is_service_enabled n-vol; then start_service tgtd fi + # Setup tgtd configuration files + mkdir -p $NOVA_DIR/volumes + # Remove nova iscsi targets sudo tgtadm --op show --mode target | grep $VOLUME_NAME_PREFIX | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true # Clean out existing volumes @@ -1711,6 +1714,12 @@ elif is_service_enabled n-vol; then fi if [[ "$os_PACKAGE" = "deb" ]]; then + + # Setup the tgt configuration file + if [[ ! -f /etc/tgt/conf.d/nova.conf ]]; then + echo "include $NOVA_DIR/volumes/*" | sudo tee /etc/tgt/conf.d/nova.conf + fi + # tgt in oneiric doesn't restart properly if tgtd isn't running # do it in two steps sudo stop tgt || true