Browse code

Setup tgtd configuration files

Setup devstack to use tgtd confiuration files.

Change-Id: Icb2a1a0c5ca517604f9a3930e7c89e3be9a36b0c
Signed-off-by: Chuck Short <chuck.short@canonical.com>

Chuck Short authored on 2012/07/29 03:28:33
Showing 2 changed files
... ...
@@ -142,6 +142,8 @@ function init_cinder() {
142 142
             if ! sudo vgs $VOLUME_GROUP; then sudo vgcreate $VOLUME_GROUP $DEV; fi
143 143
         fi
144 144
 
145
+        mkdir -p $CINDER_DIR/volumes
146
+
145 147
         if sudo vgs $VOLUME_GROUP; then
146 148
             if [[ "$os_PACKAGE" = "rpm" ]]; then
147 149
                 # RPM doesn't start the service
... ...
@@ -171,6 +173,9 @@ function install_cinder() {
171 171
 function start_cinder() {
172 172
     if is_service_enabled c-vol; then
173 173
         if [[ "$os_PACKAGE" = "deb" ]]; then
174
+            if [[ ! -f /etc/tgt/conf.d/cinder.conf ]]; then
175
+               echo "include $CINDER_DIR/volumes/*" | sudo tee /etc/tgt/conf.d/cinder.conf
176
+            fi
174 177
             # tgt in oneiric doesn't restart properly if tgtd isn't running
175 178
             # do it in two steps
176 179
             sudo stop tgt || true
... ...
@@ -1699,6 +1699,9 @@ elif is_service_enabled n-vol; then
1699 1699
             start_service tgtd
1700 1700
         fi
1701 1701
 
1702
+        # Setup tgtd configuration files
1703
+        mkdir -p $NOVA_DIR/volumes
1704
+
1702 1705
         # Remove nova iscsi targets
1703 1706
         sudo tgtadm --op show --mode target | grep $VOLUME_NAME_PREFIX | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true
1704 1707
         # Clean out existing volumes
... ...
@@ -1711,6 +1714,12 @@ elif is_service_enabled n-vol; then
1711 1711
     fi
1712 1712
 
1713 1713
     if [[ "$os_PACKAGE" = "deb" ]]; then
1714
+
1715
+        # Setup the tgt configuration file
1716
+        if [[ ! -f /etc/tgt/conf.d/nova.conf ]]; then
1717
+           echo "include $NOVA_DIR/volumes/*" | sudo tee /etc/tgt/conf.d/nova.conf
1718
+        fi
1719
+
1714 1720
         # tgt in oneiric doesn't restart properly if tgtd isn't running
1715 1721
         # do it in two steps
1716 1722
         sudo stop tgt || true