This patch setup cellsv2 for Nova after plugin initialization phase.
Since this requires compute hosts to be started, we need to do it
after we have initialized all other plugins. Things like ironic
aren't setup when we were running this as part of nova setup, and
thus this command can fail.
When cellsv1 is used (n-cell is enabled) skip calling
cells_v2 simple_cell_setup, which will never have hosts
at the top level and which will always fail.
Change-Id: Ic7d0115da51d6ea17ee49071af259a7789c62ab9
Depends-On: I9bbaa4c92503222c9fd015fe075926b50f3dcc8c
... | ... |
@@ -946,6 +946,15 @@ function create_flavors { |
946 | 946 |
fi |
947 | 947 |
} |
948 | 948 |
|
949 |
+# create_cell(): Group the available hosts into a cell |
|
950 |
+function create_cell { |
|
951 |
+ if ! is_service_enabled n-cell; then |
|
952 |
+ nova-manage cell_v2 simple_cell_setup --transport-url $(get_transport_url) |
|
953 |
+ else |
|
954 |
+ echo 'Skipping cellsv2 setup for this cellsv1 configuration' |
|
955 |
+ fi |
|
956 |
+} |
|
957 |
+ |
|
949 | 958 |
# Restore xtrace |
950 | 959 |
$_XTRACE_LIB_NOVA |
951 | 960 |
|
... | ... |
@@ -1379,6 +1379,14 @@ service_check |
1379 | 1379 |
check_libs_from_git |
1380 | 1380 |
|
1381 | 1381 |
|
1382 |
+# Configure nova cellsv2 |
|
1383 |
+# ---------------------- |
|
1384 |
+ |
|
1385 |
+# Do this late because it requires compute hosts to have started |
|
1386 |
+if is_service_enabled n-api && [ "$NOVA_CONFIGURE_CELLSV2" == "True" ]; then |
|
1387 |
+ create_cell |
|
1388 |
+fi |
|
1389 |
+ |
|
1382 | 1390 |
# Bash completion |
1383 | 1391 |
# =============== |
1384 | 1392 |
|