Browse code

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

Chris Behrens authored on 2013/07/24 19:56:13
Showing 8 changed files
... ...
@@ -188,15 +188,5 @@ Cells is a new scaling option with a full spec at http://wiki.openstack.org/blue
188 188
 To setup a cells environment add the following to your `localrc`:
189 189
 
190 190
     enable_service n-cell
191
-    enable_service n-api-meta
192
-    MULTI_HOST=True
193
-
194
-    # The following have not been tested with cells, they may or may not work.
195
-    disable_service n-obj
196
-    disable_service cinder
197
-    disable_service c-sch
198
-    disable_service c-api
199
-    disable_service c-vol
200
-    disable_service n-xvnc
201
-
202
-Be aware that there are some features currently missing in cells, one notable one being security groups.
191
+
192
+Be aware that there are some features currently missing in cells, one notable one being security groups.  The exercises have been patched to disable functionality not supported by cells.
... ...
@@ -42,6 +42,8 @@ source $TOP_DIR/exerciserc
42 42
 # Test as the admin user
43 43
 . $TOP_DIR/openrc admin admin
44 44
 
45
+# Cells does not support aggregates.
46
+is_service_enabled n-cell && exit 55
45 47
 
46 48
 # Create an aggregate
47 49
 # ===================
... ...
@@ -80,12 +80,18 @@ die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME"
80 80
 # List security groups
81 81
 nova secgroup-list
82 82
 
83
-# Create a secgroup
84
-if ! nova secgroup-list | grep -q $SECGROUP; then
85
-    nova secgroup-create $SECGROUP "$SECGROUP description"
86
-    if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova secgroup-list | grep -q $SECGROUP; do sleep 1; done"; then
87
-        echo "Security group not created"
88
-        exit 1
83
+if is_service_enabled n-cell; then
84
+    # Cells does not support security groups, so force the use of "default"
85
+    SECGROUP="default"
86
+    echo "Using the default security group because of Cells."
87
+else
88
+    # Create a secgroup
89
+    if ! nova secgroup-list | grep -q $SECGROUP; then
90
+        nova secgroup-create $SECGROUP "$SECGROUP description"
91
+        if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova secgroup-list | grep -q $SECGROUP; do sleep 1; done"; then
92
+            echo "Security group not created"
93
+            exit 1
94
+        fi
89 95
     fi
90 96
 fi
91 97
 
... ...
@@ -200,8 +206,12 @@ fi
200 200
 end_time=$(date +%s)
201 201
 echo "Completed cinder delete in $((end_time - start_time)) seconds"
202 202
 
203
-# Delete secgroup
204
-nova secgroup-delete $SECGROUP || die $LINENO "Failure deleting security group $SECGROUP"
203
+if [[ $SECGROUP = "default" ]] ; then
204
+    echo "Skipping deleting default security group"
205
+else
206
+    # Delete secgroup
207
+    nova secgroup-delete $SECGROUP || die $LINENO "Failure deleting security group $SECGROUP"
208
+fi
205 209
 
206 210
 set +o xtrace
207 211
 echo "*********************************************************************"
... ...
@@ -58,11 +58,17 @@ SECGROUP=${SECGROUP:-euca_secgroup}
58 58
 IMAGE=`euca-describe-images | grep machine | grep ${DEFAULT_IMAGE_NAME} | cut -f2 | head -n1`
59 59
 die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME"
60 60
 
61
-# Add a secgroup
62
-if ! euca-describe-groups | grep -q $SECGROUP; then
63
-    euca-add-group -d "$SECGROUP description" $SECGROUP
64
-    if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! euca-describe-groups | grep -q $SECGROUP; do sleep 1; done"; then
65
-        die $LINENO "Security group not created"
61
+if is_service_enabled n-cell; then
62
+    # Cells does not support security groups, so force the use of "default"
63
+    SECGROUP="default"
64
+    echo "Using the default security group because of Cells."
65
+else
66
+    # Add a secgroup
67
+    if ! euca-describe-groups | grep -q $SECGROUP; then
68
+        euca-add-group -d "$SECGROUP description" $SECGROUP
69
+        if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! euca-describe-groups | grep -q $SECGROUP; do sleep 1; done"; then
70
+            die $LINENO "Security group not created"
71
+        fi
66 72
     fi
67 73
 fi
68 74
 
... ...
@@ -77,7 +83,7 @@ fi
77 77
 
78 78
 # Volumes
79 79
 # -------
80
-if [[ "$ENABLED_SERVICES" =~ "c-vol" ]]; then
80
+if is_service_enabled c-vol && ! is_service_enabled n-cell; then
81 81
    VOLUME_ZONE=`euca-describe-availability-zones | head -n1 | cut -f2`
82 82
    die_if_not_set $LINENO VOLUME_ZONE "Failure to find zone for volume"
83 83
 
... ...
@@ -117,41 +123,45 @@ else
117 117
     echo "Volume Tests Skipped"
118 118
 fi
119 119
 
120
-# Allocate floating address
121
-FLOATING_IP=`euca-allocate-address | cut -f2`
122
-die_if_not_set $LINENO FLOATING_IP "Failure allocating floating IP"
120
+if is_service_enabled n-cell; then
121
+    echo "Floating IP Tests Skipped because of Cells."
122
+else
123
+    # Allocate floating address
124
+    FLOATING_IP=`euca-allocate-address | cut -f2`
125
+    die_if_not_set $LINENO FLOATING_IP "Failure allocating floating IP"
123 126
 
124
-# Associate floating address
125
-euca-associate-address -i $INSTANCE $FLOATING_IP || \
126
-    die $LINENO "Failure associating address $FLOATING_IP to $INSTANCE"
127
+    # Associate floating address
128
+    euca-associate-address -i $INSTANCE $FLOATING_IP || \
129
+        die $LINENO "Failure associating address $FLOATING_IP to $INSTANCE"
127 130
 
128
-# Authorize pinging
129
-euca-authorize -P icmp -s 0.0.0.0/0 -t -1:-1 $SECGROUP || \
130
-    die $LINENO "Failure authorizing rule in $SECGROUP"
131
+    # Authorize pinging
132
+    euca-authorize -P icmp -s 0.0.0.0/0 -t -1:-1 $SECGROUP || \
133
+        die $LINENO "Failure authorizing rule in $SECGROUP"
131 134
 
132
-# Test we can ping our floating ip within ASSOCIATE_TIMEOUT seconds
133
-ping_check "$PUBLIC_NETWORK_NAME" $FLOATING_IP $ASSOCIATE_TIMEOUT
135
+    # Test we can ping our floating ip within ASSOCIATE_TIMEOUT seconds
136
+    ping_check "$PUBLIC_NETWORK_NAME" $FLOATING_IP $ASSOCIATE_TIMEOUT
134 137
 
135
-# Revoke pinging
136
-euca-revoke -P icmp -s 0.0.0.0/0 -t -1:-1 $SECGROUP || \
137
-    die $LINENO "Failure revoking rule in $SECGROUP"
138
+    # Revoke pinging
139
+    euca-revoke -P icmp -s 0.0.0.0/0 -t -1:-1 $SECGROUP || \
140
+        die $LINENO "Failure revoking rule in $SECGROUP"
138 141
 
139
-# Release floating address
140
-euca-disassociate-address $FLOATING_IP || \
141
-    die $LINENO "Failure disassociating address $FLOATING_IP"
142
+    # Release floating address
143
+    euca-disassociate-address $FLOATING_IP || \
144
+        die $LINENO "Failure disassociating address $FLOATING_IP"
142 145
 
143
-# Wait just a tick for everything above to complete so release doesn't fail
144
-if ! timeout $ASSOCIATE_TIMEOUT sh -c "while euca-describe-addresses | grep $INSTANCE | grep -q $FLOATING_IP; do sleep 1; done"; then
145
-    die $LINENO "Floating ip $FLOATING_IP not disassociated within $ASSOCIATE_TIMEOUT seconds"
146
-fi
146
+    # Wait just a tick for everything above to complete so release doesn't fail
147
+    if ! timeout $ASSOCIATE_TIMEOUT sh -c "while euca-describe-addresses | grep $INSTANCE | grep -q $FLOATING_IP; do sleep 1; done"; then
148
+        die $LINENO "Floating ip $FLOATING_IP not disassociated within $ASSOCIATE_TIMEOUT seconds"
149
+    fi
147 150
 
148
-# Release floating address
149
-euca-release-address $FLOATING_IP || \
150
-    die $LINENO "Failure releasing address $FLOATING_IP"
151
+    # Release floating address
152
+    euca-release-address $FLOATING_IP || \
153
+        die $LINENO "Failure releasing address $FLOATING_IP"
151 154
 
152
-# Wait just a tick for everything above to complete so terminate doesn't fail
153
-if ! timeout $ASSOCIATE_TIMEOUT sh -c "while euca-describe-addresses | grep -q $FLOATING_IP; do sleep 1; done"; then
154
-    die $LINENO "Floating ip $FLOATING_IP not released within $ASSOCIATE_TIMEOUT seconds"
155
+    # Wait just a tick for everything above to complete so terminate doesn't fail
156
+    if ! timeout $ASSOCIATE_TIMEOUT sh -c "while euca-describe-addresses | grep -q $FLOATING_IP; do sleep 1; done"; then
157
+        die $LINENO "Floating ip $FLOATING_IP not released within $ASSOCIATE_TIMEOUT seconds"
158
+    fi
155 159
 fi
156 160
 
157 161
 # Terminate instance
... ...
@@ -166,8 +176,12 @@ if ! timeout $TERMINATE_TIMEOUT sh -c "while euca-describe-instances $INSTANCE |
166 166
     die $LINENO "server didn't terminate within $TERMINATE_TIMEOUT seconds"
167 167
 fi
168 168
 
169
-# Delete secgroup
170
-euca-delete-group $SECGROUP || die $LINENO "Failure deleting security group $SECGROUP"
169
+if [[ "$SECGROUP" = "default" ]] ; then
170
+    echo "Skipping deleting default security group"
171
+else
172
+    # Delete secgroup
173
+    euca-delete-group $SECGROUP || die $LINENO "Failure deleting security group $SECGROUP"
174
+fi
171 175
 
172 176
 set +o xtrace
173 177
 echo "*********************************************************************"
... ...
@@ -56,6 +56,8 @@ TEST_FLOATING_POOL=${TEST_FLOATING_POOL:-test}
56 56
 # Instance name
57 57
 VM_NAME="ex-float"
58 58
 
59
+# Cells does not support floating ips API calls
60
+is_service_enabled n-cell && exit 55
59 61
 
60 62
 # Launching a server
61 63
 # ==================
... ...
@@ -78,12 +78,18 @@ die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME"
78 78
 # List security groups
79 79
 nova secgroup-list
80 80
 
81
-# Create a secgroup
82
-if ! nova secgroup-list | grep -q $SECGROUP; then
83
-    nova secgroup-create $SECGROUP "$SECGROUP description"
84
-    if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova secgroup-list | grep -q $SECGROUP; do sleep 1; done"; then
85
-        echo "Security group not created"
86
-        exit 1
81
+if is_service_enabled n-cell; then
82
+    # Cells does not support security groups, so force the use of "default"
83
+    SECGROUP="default"
84
+    echo "Using the default security group because of Cells."
85
+else
86
+    # Create a secgroup
87
+    if ! nova secgroup-list | grep -q $SECGROUP; then
88
+        nova secgroup-create $SECGROUP "$SECGROUP description"
89
+        if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova secgroup-list | grep -q $SECGROUP; do sleep 1; done"; then
90
+            echo "Security group not created"
91
+            exit 1
92
+        fi
87 93
     fi
88 94
 fi
89 95
 
... ...
@@ -201,8 +207,12 @@ if ! timeout $TERMINATE_TIMEOUT sh -c "while nova list | grep -q $VM_UUID; do sl
201 201
     die $LINENO "Server $VM_NAME not deleted"
202 202
 fi
203 203
 
204
-# Delete secgroup
205
-nova secgroup-delete $SECGROUP || die $LINENO "Failure deleting security group $SECGROUP"
204
+if [[ $SECGROUP = "default" ]] ; then
205
+    echo "Skipping deleting default security group"
206
+else
207
+    # Delete secgroup
208
+    nova secgroup-delete $SECGROUP || die $LINENO "Failure deleting security group $SECGROUP"
209
+fi
206 210
 
207 211
 set +o xtrace
208 212
 echo "*********************************************************************"
... ...
@@ -745,12 +745,17 @@ function is_running() {
745 745
 #   For backward compatibility if we have **swift** in ENABLED_SERVICES all the
746 746
 #   **s-** services will be enabled. This will be deprecated in the future.
747 747
 #
748
+# Cells within nova is enabled if **n-cell** is in ``ENABLED_SERVICES``.
749
+# We also need to make sure to treat **n-cell-region** and **n-cell-child**
750
+# as enabled in this case.
751
+#
748 752
 # Uses global ``ENABLED_SERVICES``
749 753
 # is_service_enabled service [service ...]
750 754
 function is_service_enabled() {
751 755
     services=$@
752 756
     for service in ${services}; do
753 757
         [[ ,${ENABLED_SERVICES}, =~ ,${service}, ]] && return 0
758
+        [[ ${service} == n-cell-* && ${ENABLED_SERVICES} =~ "n-cell" ]] && return 0
754 759
         [[ ${service} == "nova" && ${ENABLED_SERVICES} =~ "n-" ]] && return 0
755 760
         [[ ${service} == "cinder" && ${ENABLED_SERVICES} =~ "c-" ]] && return 0
756 761
         [[ ${service} == "ceilometer" && ${ENABLED_SERVICES} =~ "ceilometer-" ]] && return 0
... ...
@@ -568,11 +568,11 @@ function init_nova_cells() {
568 568
         iniset $NOVA_CELLS_CONF DEFAULT rabbit_virtual_host child_cell
569 569
         iniset $NOVA_CELLS_CONF DEFAULT dhcpbridge_flagfile $NOVA_CELLS_CONF
570 570
         iniset $NOVA_CELLS_CONF cells enable True
571
+        iniset $NOVA_CELLS_CONF cells cell_type compute
571 572
         iniset $NOVA_CELLS_CONF cells name child
572 573
 
573
-        iniset $NOVA_CONF DEFAULT scheduler_topic cells
574
-        iniset $NOVA_CONF DEFAULT compute_api_class nova.compute.cells_api.ComputeCellsAPI
575 574
         iniset $NOVA_CONF cells enable True
575
+        iniset $NOVA_CONF cells cell_type api
576 576
         iniset $NOVA_CONF cells name region
577 577
 
578 578
         if is_service_enabled n-api-meta; then
... ...
@@ -714,8 +714,8 @@ function start_nova() {
714 714
     if is_service_enabled n-cell; then
715 715
         NOVA_CONF_BOTTOM=$NOVA_CELLS_CONF
716 716
         screen_it n-cond "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-conductor --config-file $NOVA_CELLS_CONF"
717
-        screen_it n-cell "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cells --config-file $NOVA_CONF"
718
-        screen_it n-cell "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cells --config-file $NOVA_CELLS_CONF"
717
+        screen_it n-cell-region "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cells --config-file $NOVA_CONF"
718
+        screen_it n-cell-child "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cells --config-file $NOVA_CELLS_CONF"
719 719
     fi
720 720
 
721 721
     if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then