* Update for blueprint general-host-aggregates
* Test for add/remove hosts
* Now uses nova host-list
Change-Id: Id6fef649c13032cf9148d7152fa2b28654717892
| ... | ... |
@@ -7,14 +7,15 @@ |
| 7 | 7 |
# * Updating Aggregate details |
| 8 | 8 |
# * Testing Aggregate metadata |
| 9 | 9 |
# * Testing Aggregate delete |
| 10 |
-# * TODO(johngar) - test adding a host (idealy with two hosts) |
|
| 10 |
+# * Testing General Aggregates (https://blueprints.launchpad.net/nova/+spec/general-host-aggregates) |
|
| 11 |
+# * Testing add/remove hosts (with one host) |
|
| 11 | 12 |
|
| 12 | 13 |
echo "**************************************************" |
| 13 | 14 |
echo "Begin DevStack Exercise: $0" |
| 14 | 15 |
echo "**************************************************" |
| 15 | 16 |
|
| 16 | 17 |
# This script exits on an error so that errors don't compound and you see |
| 17 |
-# only the first error that occured. |
|
| 18 |
+# only the first error that occurred. |
|
| 18 | 19 |
set -o errexit |
| 19 | 20 |
|
| 20 | 21 |
# Print the commands being run so that we can see the command that triggers |
| ... | ... |
@@ -47,6 +48,7 @@ OS_USERNAME=admin |
| 47 | 47 |
# =================== |
| 48 | 48 |
|
| 49 | 49 |
AGGREGATE_NAME=test_aggregate_$RANDOM |
| 50 |
+AGGREGATE2_NAME=test_aggregate_$RANDOM |
|
| 50 | 51 |
AGGREGATE_A_ZONE=nova |
| 51 | 52 |
|
| 52 | 53 |
exit_if_aggregate_present() {
|
| ... | ... |
@@ -63,6 +65,7 @@ exit_if_aggregate_present() {
|
| 63 | 63 |
exit_if_aggregate_present $AGGREGATE_NAME |
| 64 | 64 |
|
| 65 | 65 |
AGGREGATE_ID=`nova aggregate-create $AGGREGATE_NAME $AGGREGATE_A_ZONE | grep " $AGGREGATE_NAME " | get_field 1` |
| 66 |
+AGGREGATE2_ID=`nova aggregate-create $AGGREGATE2_NAME $AGGREGATE_A_ZONE | grep " $AGGREGATE2_NAME " | get_field 1` |
|
| 66 | 67 |
|
| 67 | 68 |
# check aggregate created |
| 68 | 69 |
nova aggregate-list | grep -q " $AGGREGATE_NAME " || die "Aggregate $AGGREGATE_NAME not created" |
| ... | ... |
@@ -120,13 +123,23 @@ nova aggregate-details $AGGREGATE_ID | grep {}
|
| 120 | 120 |
# Test aggregate-add/remove-host |
| 121 | 121 |
# ============================== |
| 122 | 122 |
if [ "$VIRT_DRIVER" == "xenserver" ]; then |
| 123 |
- echo "TODO(johngarbutt) add tests for add/remove host from aggregate" |
|
| 123 |
+ echo "TODO(johngarbutt) add tests for add/remove host from pool aggregate" |
|
| 124 | 124 |
fi |
| 125 |
- |
|
| 125 |
+HOST=`nova host-list | grep compute | get_field 1` |
|
| 126 |
+# Make sure can add two aggregates to same host |
|
| 127 |
+nova aggregate-add-host $AGGREGATE_ID $HOST |
|
| 128 |
+nova aggregate-add-host $AGGREGATE2_ID $HOST |
|
| 129 |
+if nova aggregate-add-host $AGGREGATE2_ID $HOST; then |
|
| 130 |
+ echo "ERROR could add duplicate host to single aggregate" |
|
| 131 |
+ exit -1 |
|
| 132 |
+fi |
|
| 133 |
+nova aggregate-remove-host $AGGREGATE2_ID $HOST |
|
| 134 |
+nova aggregate-remove-host $AGGREGATE_ID $HOST |
|
| 126 | 135 |
|
| 127 | 136 |
# Test aggregate-delete |
| 128 | 137 |
# ===================== |
| 129 | 138 |
nova aggregate-delete $AGGREGATE_ID |
| 139 |
+nova aggregate-delete $AGGREGATE2_ID |
|
| 130 | 140 |
exit_if_aggregate_present $AGGREGATE_NAME |
| 131 | 141 |
|
| 132 | 142 |
|