Fix various things when n-cell is enabled

1) Use the newer cell_type configuration option instead of overriding
the compute_api_class.

2) A nova-cells service is started for both the API cell (region) and
the compute cell (child).  The screen names were both 'n-cell' which
caused both services to log to the same log file.  The screen names have
been changed to n-cell-region and n-cell-child.

3) Security groups are not supported with cells.  Multiple exercises are
patched to use the 'default' security group instead of creating a new
one.  Additionally, if one uses the 'default' security group, do not try
to delete it, as one can never delete the default.

4) Disable the floating_ips and aggregates exercises when n-cell is
enabled, as they are not supported by cells.

5) Related to #4, disable the floating_ips tests within euca.sh

6) Update the README.md.  No services need to be disabled, and one only
needs to enable the n-cell service.

Change-Id: I9782d1e3cda3c9dd3daefa15c043f5b06473cb87
diff --git a/exercises/aggregates.sh b/exercises/aggregates.sh
index 3c83725..e2baecd 100755
--- a/exercises/aggregates.sh
+++ b/exercises/aggregates.sh
@@ -42,6 +42,8 @@
 # Test as the admin user
 . $TOP_DIR/openrc admin admin
 
+# Cells does not support aggregates.
+is_service_enabled n-cell && exit 55
 
 # Create an aggregate
 # ===================
diff --git a/exercises/boot_from_volume.sh b/exercises/boot_from_volume.sh
index 1814732..a3a14eb 100755
--- a/exercises/boot_from_volume.sh
+++ b/exercises/boot_from_volume.sh
@@ -80,12 +80,18 @@
 # List security groups
 nova secgroup-list
 
-# Create a secgroup
-if ! nova secgroup-list | grep -q $SECGROUP; then
-    nova secgroup-create $SECGROUP "$SECGROUP description"
-    if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova secgroup-list | grep -q $SECGROUP; do sleep 1; done"; then
-        echo "Security group not created"
-        exit 1
+if is_service_enabled n-cell; then
+    # Cells does not support security groups, so force the use of "default"
+    SECGROUP="default"
+    echo "Using the default security group because of Cells."
+else
+    # Create a secgroup
+    if ! nova secgroup-list | grep -q $SECGROUP; then
+        nova secgroup-create $SECGROUP "$SECGROUP description"
+        if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova secgroup-list | grep -q $SECGROUP; do sleep 1; done"; then
+            echo "Security group not created"
+            exit 1
+        fi
     fi
 fi
 
@@ -200,8 +206,12 @@
 end_time=$(date +%s)
 echo "Completed cinder delete in $((end_time - start_time)) seconds"
 
-# Delete secgroup
-nova secgroup-delete $SECGROUP || die $LINENO "Failure deleting security group $SECGROUP"
+if [[ $SECGROUP = "default" ]] ; then
+    echo "Skipping deleting default security group"
+else
+    # Delete secgroup
+    nova secgroup-delete $SECGROUP || die $LINENO "Failure deleting security group $SECGROUP"
+fi
 
 set +o xtrace
 echo "*********************************************************************"
diff --git a/exercises/euca.sh b/exercises/euca.sh
index eec8636..5b0d1ba 100755
--- a/exercises/euca.sh
+++ b/exercises/euca.sh
@@ -58,11 +58,17 @@
 IMAGE=`euca-describe-images | grep machine | grep ${DEFAULT_IMAGE_NAME} | cut -f2 | head -n1`
 die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME"
 
-# Add a secgroup
-if ! euca-describe-groups | grep -q $SECGROUP; then
-    euca-add-group -d "$SECGROUP description" $SECGROUP
-    if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! euca-describe-groups | grep -q $SECGROUP; do sleep 1; done"; then
-        die $LINENO "Security group not created"
+if is_service_enabled n-cell; then
+    # Cells does not support security groups, so force the use of "default"
+    SECGROUP="default"
+    echo "Using the default security group because of Cells."
+else
+    # Add a secgroup
+    if ! euca-describe-groups | grep -q $SECGROUP; then
+        euca-add-group -d "$SECGROUP description" $SECGROUP
+        if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! euca-describe-groups | grep -q $SECGROUP; do sleep 1; done"; then
+            die $LINENO "Security group not created"
+        fi
     fi
 fi
 
@@ -77,7 +83,7 @@
 
 # Volumes
 # -------
-if [[ "$ENABLED_SERVICES" =~ "c-vol" ]]; then
+if is_service_enabled c-vol && ! is_service_enabled n-cell; then
    VOLUME_ZONE=`euca-describe-availability-zones | head -n1 | cut -f2`
    die_if_not_set $LINENO VOLUME_ZONE "Failure to find zone for volume"
 
@@ -117,41 +123,45 @@
     echo "Volume Tests Skipped"
 fi
 
-# Allocate floating address
-FLOATING_IP=`euca-allocate-address | cut -f2`
-die_if_not_set $LINENO FLOATING_IP "Failure allocating floating IP"
+if is_service_enabled n-cell; then
+    echo "Floating IP Tests Skipped because of Cells."
+else
+    # Allocate floating address
+    FLOATING_IP=`euca-allocate-address | cut -f2`
+    die_if_not_set $LINENO FLOATING_IP "Failure allocating floating IP"
 
-# Associate floating address
-euca-associate-address -i $INSTANCE $FLOATING_IP || \
-    die $LINENO "Failure associating address $FLOATING_IP to $INSTANCE"
+    # Associate floating address
+    euca-associate-address -i $INSTANCE $FLOATING_IP || \
+        die $LINENO "Failure associating address $FLOATING_IP to $INSTANCE"
 
-# Authorize pinging
-euca-authorize -P icmp -s 0.0.0.0/0 -t -1:-1 $SECGROUP || \
-    die $LINENO "Failure authorizing rule in $SECGROUP"
+    # Authorize pinging
+    euca-authorize -P icmp -s 0.0.0.0/0 -t -1:-1 $SECGROUP || \
+        die $LINENO "Failure authorizing rule in $SECGROUP"
 
-# Test we can ping our floating ip within ASSOCIATE_TIMEOUT seconds
-ping_check "$PUBLIC_NETWORK_NAME" $FLOATING_IP $ASSOCIATE_TIMEOUT
+    # Test we can ping our floating ip within ASSOCIATE_TIMEOUT seconds
+    ping_check "$PUBLIC_NETWORK_NAME" $FLOATING_IP $ASSOCIATE_TIMEOUT
 
-# Revoke pinging
-euca-revoke -P icmp -s 0.0.0.0/0 -t -1:-1 $SECGROUP || \
-    die $LINENO "Failure revoking rule in $SECGROUP"
+    # Revoke pinging
+    euca-revoke -P icmp -s 0.0.0.0/0 -t -1:-1 $SECGROUP || \
+        die $LINENO "Failure revoking rule in $SECGROUP"
 
-# Release floating address
-euca-disassociate-address $FLOATING_IP || \
-    die $LINENO "Failure disassociating address $FLOATING_IP"
+    # Release floating address
+    euca-disassociate-address $FLOATING_IP || \
+        die $LINENO "Failure disassociating address $FLOATING_IP"
 
-# Wait just a tick for everything above to complete so release doesn't fail
-if ! timeout $ASSOCIATE_TIMEOUT sh -c "while euca-describe-addresses | grep $INSTANCE | grep -q $FLOATING_IP; do sleep 1; done"; then
-    die $LINENO "Floating ip $FLOATING_IP not disassociated within $ASSOCIATE_TIMEOUT seconds"
-fi
+    # Wait just a tick for everything above to complete so release doesn't fail
+    if ! timeout $ASSOCIATE_TIMEOUT sh -c "while euca-describe-addresses | grep $INSTANCE | grep -q $FLOATING_IP; do sleep 1; done"; then
+        die $LINENO "Floating ip $FLOATING_IP not disassociated within $ASSOCIATE_TIMEOUT seconds"
+    fi
 
-# Release floating address
-euca-release-address $FLOATING_IP || \
-    die $LINENO "Failure releasing address $FLOATING_IP"
+    # Release floating address
+    euca-release-address $FLOATING_IP || \
+        die $LINENO "Failure releasing address $FLOATING_IP"
 
-# Wait just a tick for everything above to complete so terminate doesn't fail
-if ! timeout $ASSOCIATE_TIMEOUT sh -c "while euca-describe-addresses | grep -q $FLOATING_IP; do sleep 1; done"; then
-    die $LINENO "Floating ip $FLOATING_IP not released within $ASSOCIATE_TIMEOUT seconds"
+    # Wait just a tick for everything above to complete so terminate doesn't fail
+    if ! timeout $ASSOCIATE_TIMEOUT sh -c "while euca-describe-addresses | grep -q $FLOATING_IP; do sleep 1; done"; then
+        die $LINENO "Floating ip $FLOATING_IP not released within $ASSOCIATE_TIMEOUT seconds"
+    fi
 fi
 
 # Terminate instance
@@ -166,8 +176,12 @@
     die $LINENO "server didn't terminate within $TERMINATE_TIMEOUT seconds"
 fi
 
-# Delete secgroup
-euca-delete-group $SECGROUP || die $LINENO "Failure deleting security group $SECGROUP"
+if [[ "$SECGROUP" = "default" ]] ; then
+    echo "Skipping deleting default security group"
+else
+    # Delete secgroup
+    euca-delete-group $SECGROUP || die $LINENO "Failure deleting security group $SECGROUP"
+fi
 
 set +o xtrace
 echo "*********************************************************************"
diff --git a/exercises/floating_ips.sh b/exercises/floating_ips.sh
index b22ef11..ac65cf7 100755
--- a/exercises/floating_ips.sh
+++ b/exercises/floating_ips.sh
@@ -56,6 +56,8 @@
 # Instance name
 VM_NAME="ex-float"
 
+# Cells does not support floating ips API calls
+is_service_enabled n-cell && exit 55
 
 # Launching a server
 # ==================
diff --git a/exercises/volumes.sh b/exercises/volumes.sh
index f574bb3..b2b391c 100755
--- a/exercises/volumes.sh
+++ b/exercises/volumes.sh
@@ -78,12 +78,18 @@
 # List security groups
 nova secgroup-list
 
-# Create a secgroup
-if ! nova secgroup-list | grep -q $SECGROUP; then
-    nova secgroup-create $SECGROUP "$SECGROUP description"
-    if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova secgroup-list | grep -q $SECGROUP; do sleep 1; done"; then
-        echo "Security group not created"
-        exit 1
+if is_service_enabled n-cell; then
+    # Cells does not support security groups, so force the use of "default"
+    SECGROUP="default"
+    echo "Using the default security group because of Cells."
+else
+    # Create a secgroup
+    if ! nova secgroup-list | grep -q $SECGROUP; then
+        nova secgroup-create $SECGROUP "$SECGROUP description"
+        if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova secgroup-list | grep -q $SECGROUP; do sleep 1; done"; then
+            echo "Security group not created"
+            exit 1
+        fi
     fi
 fi
 
@@ -201,8 +207,12 @@
     die $LINENO "Server $VM_NAME not deleted"
 fi
 
-# Delete secgroup
-nova secgroup-delete $SECGROUP || die $LINENO "Failure deleting security group $SECGROUP"
+if [[ $SECGROUP = "default" ]] ; then
+    echo "Skipping deleting default security group"
+else
+    # Delete secgroup
+    nova secgroup-delete $SECGROUP || die $LINENO "Failure deleting security group $SECGROUP"
+fi
 
 set +o xtrace
 echo "*********************************************************************"