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