Remove support for nova-volume

* nova-volume has been removed in Grizzly
* part of delete-nova-volume

Change-Id: Iba91d69950767823d77aaaa93243b0f476dbb04d
diff --git a/exercises/boot_from_volume.sh b/exercises/boot_from_volume.sh
index b06c8dd..4562ac0 100755
--- a/exercises/boot_from_volume.sh
+++ b/exercises/boot_from_volume.sh
@@ -35,9 +35,9 @@
 # Import exercise configuration
 source $TOP_DIR/exerciserc
 
-# If cinder or n-vol are not enabled we exit with exitcode 55 so that
+# If cinder is not enabled we exit with exitcode 55 so that
 # the exercise is skipped
-is_service_enabled cinder n-vol || exit 55
+is_service_enabled cinder || exit 55
 
 # Boot this image, use first AMI image if unset
 DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-ami}
diff --git a/exercises/euca.sh b/exercises/euca.sh
index b121493..5480b76 100755
--- a/exercises/euca.sh
+++ b/exercises/euca.sh
@@ -73,7 +73,7 @@
 
 # Volumes
 # -------
-if [[ "$ENABLED_SERVICES" =~ "n-vol" || "$ENABLED_SERVICES" =~ "c-vol" ]]; then
+if [[ "$ENABLED_SERVICES" =~ "c-vol" ]]; then
    VOLUME_ZONE=`euca-describe-availability-zones | head -n1 | cut -f2`
    die_if_not_set VOLUME_ZONE "Failure to find zone for volume"
 
diff --git a/exercises/volumes.sh b/exercises/volumes.sh
index 72c8729..6892739 100755
--- a/exercises/volumes.sh
+++ b/exercises/volumes.sh
@@ -9,7 +9,7 @@
 echo "*********************************************************************"
 
 # This script exits on an error so that errors don't compound and you see
-# only the first error that occured.
+# only the first error that occurred.
 set -o errexit
 
 # Print the commands being run so that we can see the command that triggers
@@ -33,9 +33,9 @@
 # Import exercise configuration
 source $TOP_DIR/exerciserc
 
-# If cinder or n-vol are not enabled we exit with exitcode 55 which mean
+# If cinder is not enabled we exit with exitcode 55 which mean
 # exercise is skipped.
-is_service_enabled cinder n-vol || exit 55
+is_service_enabled cinder || exit 55
 
 # Instance type to create
 DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}
diff --git a/files/keystone_data.sh b/files/keystone_data.sh
index 3da11bf..71994a8 100755
--- a/files/keystone_data.sh
+++ b/files/keystone_data.sh
@@ -140,22 +140,6 @@
         --role_id $RESELLER_ROLE
 fi
 
-# Volume
-if [[ "$ENABLED_SERVICES" =~ "n-vol" ]]; then
-    if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
-        VOLUME_SERVICE=$(get_id keystone service-create \
-            --name=volume \
-            --type=volume \
-            --description="Volume Service")
-        keystone endpoint-create \
-            --region RegionOne \
-            --service_id $VOLUME_SERVICE \
-            --publicurl "http://$SERVICE_HOST:8776/v1/\$(tenant_id)s" \
-            --adminurl "http://$SERVICE_HOST:8776/v1/\$(tenant_id)s" \
-            --internalurl "http://$SERVICE_HOST:8776/v1/\$(tenant_id)s"
-    fi
-fi
-
 # Heat
 if [[ "$ENABLED_SERVICES" =~ "heat" ]]; then
     HEAT_USER=$(get_id keystone user-create --name=heat \
diff --git a/functions b/functions
index c7f65db..90b3b78 100644
--- a/functions
+++ b/functions
@@ -462,7 +462,7 @@
 # ``ENABLED_SERVICES`` list, if they are not already present.
 #
 # For example:
-#   enable_service n-vol
+#   enable_service qpid
 #
 # This function does not know about the special cases
 # for nova, glance, and quantum built into is_service_enabled().
@@ -484,7 +484,7 @@
 # ``ENABLED_SERVICES`` list, if they are present.
 #
 # For example:
-#   disable_service n-vol
+#   disable_service rabbit
 #
 # This function does not know about the special cases
 # for nova, glance, and quantum built into is_service_enabled().
@@ -513,8 +513,8 @@
 
 
 # Remove all services starting with '-'.  For example, to install all default
-# services except nova-volume (n-vol) set in ``localrc``:
-# ENABLED_SERVICES+=",-n-vol"
+# services except rabbit (rabbit) set in ``localrc``:
+# ENABLED_SERVICES+=",-rabbit"
 # Uses global ``ENABLED_SERVICES``
 # disable_negated_services
 function disable_negated_services() {
diff --git a/lib/n-vol b/lib/n-vol
deleted file mode 100644
index db53582..0000000
--- a/lib/n-vol
+++ /dev/null
@@ -1,126 +0,0 @@
-# lib/n-vol
-# Install and start Nova volume service
-
-# Dependencies:
-# - functions
-# - DATA_DIR must be defined
-# - KEYSTONE_AUTH_* must be defined
-# - NOVA_DIR, NOVA_BIN_DIR, NOVA_STATE_PATH must be defined
-# SERVICE_{TENANT_NAME|PASSWORD} must be defined
-# _configure_tgt_for_config_d() from lib/cinder
-
-# stack.sh
-# ---------
-# install_nvol
-# configure_nvol
-# init_nvol
-# start_nvol
-# stop_nvol
-# cleanup_nvol
-
-# Save trace setting
-XTRACE=$(set +o | grep xtrace)
-set +o xtrace
-
-
-# Defaults
-# --------
-
-# Name of the LVM volume group to use/create for iscsi volumes
-VOLUME_GROUP=${VOLUME_GROUP:-stack-volumes}
-VOLUME_NAME_PREFIX=${VOLUME_NAME_PREFIX:-volume-}
-
-
-# cleanup_nvol() - Remove residual data files, anything left over from previous
-# runs that a clean run would need to clean up
-function cleanup_nvol() {
-    # kill instances (nova)
-    # delete image files (glance)
-    # This function intentionally left blank
-    :
-}
-
-# configure_nvol() - Set config files, create data dirs, etc
-function configure_nvol() {
-    # sudo python setup.py deploy
-    # iniset $XXX_CONF ...
-    # This function intentionally left blank
-    :
-}
-
-# init_nvol() - Initialize databases, etc.
-function init_nvol() {
-    # Configure a default volume group called '`stack-volumes`' for the volume
-    # service if it does not yet exist.  If you don't wish to use a file backed
-    # volume group, create your own volume group called ``stack-volumes`` before
-    # invoking ``stack.sh``.
-    #
-    # By default, the backing file is 5G in size, and is stored in ``/opt/stack/data``.
-
-    if ! sudo vgs $VOLUME_GROUP; then
-        VOLUME_BACKING_FILE=${VOLUME_BACKING_FILE:-$DATA_DIR/${VOLUME_GROUP}-backing-file}
-        # Only create if the file doesn't already exists
-        [[ -f $VOLUME_BACKING_FILE ]] || truncate -s $VOLUME_BACKING_FILE_SIZE $VOLUME_BACKING_FILE
-        DEV=`sudo losetup -f --show $VOLUME_BACKING_FILE`
-        # Only create if the loopback device doesn't contain $VOLUME_GROUP
-        if ! sudo vgs $VOLUME_GROUP; then sudo vgcreate $VOLUME_GROUP $DEV; fi
-    fi
-
-    mkdir -p $NOVA_STATE_PATH/volumes
-
-    if sudo vgs $VOLUME_GROUP; then
-        if [[ "$os_PACKAGE" = "rpm" ]]; then
-            # RPM doesn't start the service
-            start_service tgtd
-        fi
-
-        # 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
-        for lv in `sudo lvs --noheadings -o lv_name $VOLUME_GROUP`; do
-            # ``VOLUME_NAME_PREFIX`` prefixes the LVs we want
-            if [[ "${lv#$VOLUME_NAME_PREFIX}" != "$lv" ]]; then
-                sudo lvremove -f $VOLUME_GROUP/$lv
-            fi
-        done
-    fi
-}
-
-# install_nvol() - Collect source and prepare
-function install_nvol() {
-    # git clone xxx
-    # Install is handled when installing Nova
-    :
-}
-
-# start_nvol() - Start running processes, including screen
-function start_nvol() {
-    # Setup the tgt configuration file
-    if [[ ! -f /etc/tgt/conf.d/nova.conf ]]; then
-        _configure_tgt_for_config_d
-       sudo mkdir -p /etc/tgt/conf.d
-       echo "include $NOVA_STATE_PATH/volumes/*" | sudo tee /etc/tgt/conf.d/nova.conf
-    fi
-
-    if [[ "$os_PACKAGE" = "deb" ]]; then
-        # tgt in oneiric doesn't restart properly if tgtd isn't running
-        # do it in two steps
-        sudo stop tgt || true
-        sudo start tgt
-    else
-        restart_service tgtd
-    fi
-
-    screen_it n-vol "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-volume"
-}
-
-# stop_nvol() - Stop running processes
-function stop_nvol() {
-    # Kill the nova volume screen window
-    screen -S $SCREEN_NAME -p n-vol -X kill
-
-    stop_service tgt
-}
-
-# Restore xtrace
-$XTRACE
diff --git a/lib/nova b/lib/nova
index 2c1413d..fbb5a01 100644
--- a/lib/nova
+++ b/lib/nova
@@ -312,15 +312,6 @@
     if is_service_enabled n-api; then
         add_nova_opt "enabled_apis=$NOVA_ENABLED_APIS"
     fi
-    if is_service_enabled n-vol; then
-        NOVA_ENABLED_APIS="${NOVA_ENABLED_APIS},osapi_volume"
-        iniset $NOVA_CONF DEFAULT enabled_apis $NOVA_ENABLED_APIS
-        add_nova_opt "volume_api_class=nova.volume.api.API"
-        add_nova_opt "volume_group=$VOLUME_GROUP"
-        add_nova_opt "volume_name_template=${VOLUME_NAME_PREFIX}%s"
-        # oneiric no longer supports ietadm
-        add_nova_opt "iscsi_helper=tgtadm"
-    fi
     if is_service_enabled cinder; then
         add_nova_opt "volume_api_class=nova.volume.cinder.API"
     fi
diff --git a/stack.sh b/stack.sh
index 40eab36..75e0244 100755
--- a/stack.sh
+++ b/stack.sh
@@ -93,7 +93,7 @@
 # ============
 
 # Remove services which were negated in ENABLED_SERVICES
-# using the "-" prefix (e.g., "-n-vol") instead of
+# using the "-" prefix (e.g., "-rabbit") instead of
 # calling disable_service().
 disable_negated_services
 
@@ -154,12 +154,6 @@
 fi
 unset rpc_backend_cnt
 
-# Make sure we only have one volume service enabled.
-if is_service_enabled cinder && is_service_enabled n-vol; then
-    echo "ERROR: n-vol and cinder must not be enabled at the same time"
-    exit 1
-fi
-
 # Set up logging level
 VERBOSE=$(trueorfalse True $VERBOSE)
 
@@ -310,7 +304,6 @@
 source $TOP_DIR/lib/glance
 source $TOP_DIR/lib/nova
 source $TOP_DIR/lib/cinder
-source $TOP_DIR/lib/n-vol
 source $TOP_DIR/lib/ceilometer
 source $TOP_DIR/lib/heat
 source $TOP_DIR/lib/quantum
@@ -1749,9 +1742,6 @@
 if is_service_enabled cinder; then
     echo_summary "Configuring Cinder"
     init_cinder
-elif is_service_enabled n-vol; then
-    echo_summary "Configuring Nova volumes"
-    init_nvol
 fi
 
 if is_service_enabled nova; then
@@ -1951,10 +1941,6 @@
     echo_summary "Starting Nova"
     start_nova
 fi
-if is_service_enabled n-vol; then
-    echo_summary "Starting Nova volumes"
-    start_nvol
-fi
 if is_service_enabled cinder; then
     echo_summary "Starting Cinder"
     start_cinder
diff --git a/stackrc b/stackrc
index a02bdc0..5689779 100644
--- a/stackrc
+++ b/stackrc
@@ -11,10 +11,6 @@
 # ``disable_service`` functions in ``localrc``.
 # For example, to enable Swift add this to ``localrc``:
 # enable_service swift
-#
-# And to disable Cinder and use Nova Volumes instead:
-# disable_service c-api c-sch c-vol cinder
-# enable_service n-vol
 ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,mysql,rabbit
 
 # Set the default Nova APIs to enable
diff --git a/unstack.sh b/unstack.sh
index 6b34aa3..1a2cad8 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -26,7 +26,6 @@
 
 # Get project function libraries
 source $TOP_DIR/lib/cinder
-source $TOP_DIR/lib/n-vol
 
 # Determine what system we are running on.  This provides ``os_VENDOR``,
 # ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
@@ -58,11 +57,7 @@
 SCSI_PERSIST_DIR=$CINDER_STATE_PATH/volumes/*
 
 # Get the iSCSI volumes
-if is_service_enabled cinder n-vol; then
-    if is_service_enabled n-vol; then
-        SCSI_PERSIST_DIR=$NOVA_STATE_PATH/volumes/*
-    fi
-
+if is_service_enabled cinder; then
     TARGETS=$(sudo tgtadm --op show --mode target)
     if [ $? -ne 0 ]; then
         # If tgt driver isn't running this won't work obviously
@@ -88,10 +83,6 @@
         sudo rm -rf $CINDER_STATE_PATH/volumes/*
     fi
 
-    if is_service_enabled n-vol; then
-        sudo rm -rf $NOVA_STATE_PATH/volumes/*
-    fi
-
     if [[ "$os_PACKAGE" = "deb" ]]; then
         stop_service tgt
     else