diff --git a/README.md b/README.md index fbf7b4a008..4bcd62c947 100644 --- a/README.md +++ b/README.md @@ -188,15 +188,5 @@ Cells is a new scaling option with a full spec at http://wiki.openstack.org/blue To setup a cells environment add the following to your `localrc`: enable_service n-cell - enable_service n-api-meta - MULTI_HOST=True - # The following have not been tested with cells, they may or may not work. - disable_service n-obj - disable_service cinder - disable_service c-sch - disable_service c-api - disable_service c-vol - disable_service n-xvnc - -Be aware that there are some features currently missing in cells, one notable one being security groups. +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. diff --git a/exercises/aggregates.sh b/exercises/aggregates.sh index 3c83725491..e2baecdb11 100755 --- a/exercises/aggregates.sh +++ b/exercises/aggregates.sh @@ -42,6 +42,8 @@ source $TOP_DIR/exerciserc # 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 18147325bb..a3a14eb5e4 100755 --- a/exercises/boot_from_volume.sh +++ b/exercises/boot_from_volume.sh @@ -80,12 +80,18 @@ die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME" # 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 @@ fi 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 eec8636fa3..5b0d1ba493 100755 --- a/exercises/euca.sh +++ b/exercises/euca.sh @@ -58,11 +58,17 @@ SECGROUP=${SECGROUP:-euca_secgroup} 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 @@ fi # 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 @@ else 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 @@ if ! timeout $TERMINATE_TIMEOUT sh -c "while euca-describe-instances $INSTANCE | 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 b22ef110d2..ac65cf7772 100755 --- a/exercises/floating_ips.sh +++ b/exercises/floating_ips.sh @@ -56,6 +56,8 @@ TEST_FLOATING_POOL=${TEST_FLOATING_POOL:-test} # 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 f574bb3463..b2b391c5d7 100755 --- a/exercises/volumes.sh +++ b/exercises/volumes.sh @@ -78,12 +78,18 @@ die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME" # 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 @@ if ! timeout $TERMINATE_TIMEOUT sh -c "while nova list | grep -q $VM_UUID; do sl 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 "*********************************************************************" diff --git a/functions b/functions index eb83dfb2d6..08c525348a 100644 --- a/functions +++ b/functions @@ -745,12 +745,17 @@ function is_running() { # For backward compatibility if we have **swift** in ENABLED_SERVICES all the # **s-** services will be enabled. This will be deprecated in the future. # +# Cells within nova is enabled if **n-cell** is in ``ENABLED_SERVICES``. +# We also need to make sure to treat **n-cell-region** and **n-cell-child** +# as enabled in this case. +# # Uses global ``ENABLED_SERVICES`` # is_service_enabled service [service ...] function is_service_enabled() { services=$@ for service in ${services}; do [[ ,${ENABLED_SERVICES}, =~ ,${service}, ]] && return 0 + [[ ${service} == n-cell-* && ${ENABLED_SERVICES} =~ "n-cell" ]] && return 0 [[ ${service} == "nova" && ${ENABLED_SERVICES} =~ "n-" ]] && return 0 [[ ${service} == "cinder" && ${ENABLED_SERVICES} =~ "c-" ]] && return 0 [[ ${service} == "ceilometer" && ${ENABLED_SERVICES} =~ "ceilometer-" ]] && return 0 diff --git a/lib/nova b/lib/nova index 617fb08fb4..7a5ff1f98a 100644 --- a/lib/nova +++ b/lib/nova @@ -568,11 +568,11 @@ function init_nova_cells() { iniset $NOVA_CELLS_CONF DEFAULT rabbit_virtual_host child_cell iniset $NOVA_CELLS_CONF DEFAULT dhcpbridge_flagfile $NOVA_CELLS_CONF iniset $NOVA_CELLS_CONF cells enable True + iniset $NOVA_CELLS_CONF cells cell_type compute iniset $NOVA_CELLS_CONF cells name child - iniset $NOVA_CONF DEFAULT scheduler_topic cells - iniset $NOVA_CONF DEFAULT compute_api_class nova.compute.cells_api.ComputeCellsAPI iniset $NOVA_CONF cells enable True + iniset $NOVA_CONF cells cell_type api iniset $NOVA_CONF cells name region if is_service_enabled n-api-meta; then @@ -714,8 +714,8 @@ function start_nova() { if is_service_enabled n-cell; then NOVA_CONF_BOTTOM=$NOVA_CELLS_CONF screen_it n-cond "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-conductor --config-file $NOVA_CELLS_CONF" - screen_it n-cell "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cells --config-file $NOVA_CONF" - screen_it n-cell "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cells --config-file $NOVA_CELLS_CONF" + screen_it n-cell-region "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cells --config-file $NOVA_CONF" + screen_it n-cell-child "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cells --config-file $NOVA_CELLS_CONF" fi if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then