Browse code

initial support for volumes

Anthony Young authored on 2011/10/21 02:12:58
Showing 2 changed files
... ...
@@ -127,7 +127,7 @@ OPENSTACKX_DIR=$DEST/openstackx
127 127
 NOVNC_DIR=$DEST/noVNC
128 128
 
129 129
 # Specify which services to launch.  These generally correspond to screen tabs
130
-ENABLED_SERVICES=${ENABLED_SERVICES:-g-api,g-reg,key,n-api,n-cpu,n-net,n-sch,n-vnc,dash,mysql,rabbit}
130
+ENABLED_SERVICES=${ENABLED_SERVICES:-g-api,g-reg,key,n-api,n-cpu,n-net,n-sch,n-vnc,dash,mysql,rabbit,n-vol}
131 131
 
132 132
 # Nova hypervisor configuration.  We default to **kvm** but will drop back to
133 133
 # **qemu** if we are unable to load the kvm module.  Stack.sh can also install
... ...
@@ -534,6 +534,31 @@ if [[ "$ENABLED_SERVICES" =~ "n-net" ]]; then
534 534
     mkdir -p $NOVA_DIR/networks
535 535
 fi
536 536
 
537
+# Volume Service
538
+# --------------
539
+
540
+if [[ "$ENABLED_SERVICES" =~ "n-vol" ]]; then
541
+    #
542
+    # Configure a default volume group called 'nova-volumes' for the nova-volume
543
+    # service if it does not yet exist.  If you don't wish to use a file backed
544
+    # volume group, create your own volume group called 'nova-volumes' before
545
+    # invoking stack.sh.
546
+    #
547
+    # By default, the backing file is 2G in size, and is stored in /opt/stack.
548
+    #
549
+    VOLUME_BACKING_FILE=${VOLUME_BACKING_FILE:-/opt/stack/nova-volumes-backing-file}
550
+    VOLUME_BACKING_FILE_SIZE=${VOLUME_BACKING_FILE_SIZE:-2052M}
551
+    if ! sudo vgdisplay | grep -q nova-volumes; then
552
+        truncate -s $VOLUME_BACKING_FILE_SIZE $VOLUME_BACKING_FILE
553
+        DEV=`sudo losetup -f --show $VOLUME_BACKING_FILE`
554
+        sudo vgcreate nova-volumes $DEV
555
+    fi
556
+
557
+    # Configure iscsitarget
558
+    sudo sed 's/ISCSITARGET_ENABLE=false/ISCSITARGET_ENABLE=true/' -i /etc/default/iscsitarget
559
+    sudo /etc/init.d/iscsitarget restart
560
+fi
561
+
537 562
 function add_nova_flag {
538 563
     echo "$1" >> $NOVA_DIR/bin/nova.conf
539 564
 }
... ...
@@ -671,6 +696,7 @@ fi
671 671
 # within the context of our original shell (so our groups won't be updated).
672 672
 # Use 'sg' to execute nova-compute as a member of the libvirtd group.
673 673
 screen_it n-cpu "cd $NOVA_DIR && sg libvirtd $NOVA_DIR/bin/nova-compute"
674
+screen_it n-vol "cd $NOVA_DIR && $NOVA_DIR/bin/nova-volume"
674 675
 screen_it n-net "cd $NOVA_DIR && $NOVA_DIR/bin/nova-network"
675 676
 screen_it n-sch "cd $NOVA_DIR && $NOVA_DIR/bin/nova-scheduler"
676 677
 screen_it n-vnc "cd $NOVNC_DIR && ./utils/nova-wsproxy.py 6080 --web . --flagfile=../nova/bin/nova.conf"
... ...
@@ -38,7 +38,8 @@ DEST=${DEST:-/opt/stack}
38 38
 WAIT_TILL_LAUNCH=${WAIT_TILL_LAUNCH:-1}
39 39
 
40 40
 # Param string to pass to stack.sh.  Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova"
41
-STACKSH_PARAMS=${STACKSH_PARAMS:-}
41
+# By default, n-vol is disabled for lxc
42
+STACKSH_PARAMS=${STACKSH_PARAMS:-"ENABLED_SERVICES=g-api,g-reg,key,n-api,n-cpu,n-net,n-sch,n-vnc,dash,mysql,rabbit"}
42 43
 
43 44
 # Option to use the version of devstack on which we are currently working
44 45
 USE_CURRENT_DEVSTACK=${USE_CURRENT_DEVSTACK:-1}