The map_cell0 command creates a cell mapping record in the
nova_api database, and the nova-manage db sync command
will migrate the db schema for the nova_cell0 database. This
patch takes advantage of that by moving the map_cell0 call
much earlier in the setup process so we get the nova_cell0
db schema migrated at the same time as the main nova db.
This also removes the || true condition around map_cell0
since it's idempotent now due to fix:
aa7b6ebbb254f00fcb548832941ca9dbd3996d9f
Change-Id: Ice4fbb1771270c618b2acbc933d4fbfb6805df81
| ... | ... |
@@ -683,9 +683,13 @@ function init_nova {
|
| 683 | 683 |
recreate_database nova |
| 684 | 684 |
recreate_database nova_cell0 |
| 685 | 685 |
|
| 686 |
- # Migrate nova database. If "nova-manage cell_v2 simple_cell_setup" has |
|
| 687 |
- # been run this migrates the "nova" and "nova_cell0" database. |
|
| 688 |
- # Otherwise it just migrates the "nova" database. |
|
| 686 |
+ # map_cell0 will create the cell mapping record in the nova_api DB so |
|
| 687 |
+ # this needs to come after the api_db sync happens. We also want to run |
|
| 688 |
+ # this before the db sync below since that will migrate both the nova |
|
| 689 |
+ # and nova_cell0 databases. |
|
| 690 |
+ nova-manage cell_v2 map_cell0 --database_connection `database_connection_url nova_cell0` |
|
| 691 |
+ |
|
| 692 |
+ # Migrate nova and nova_cell0 databases. |
|
| 689 | 693 |
$NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db sync |
| 690 | 694 |
|
| 691 | 695 |
if is_service_enabled n-cell; then |
| ... | ... |
@@ -945,9 +949,6 @@ function create_flavors {
|
| 945 | 945 |
|
| 946 | 946 |
# create_cell(): Group the available hosts into a cell |
| 947 | 947 |
function create_cell {
|
| 948 |
- # NOTE(danms): map_cell0 always returns 1 right now; remove this when that is fixed |
|
| 949 |
- (nova-manage cell_v2 map_cell0 --database_connection `database_connection_url nova_cell0`|| true) |
|
| 950 |
- |
|
| 951 | 948 |
if ! is_service_enabled n-cell; then |
| 952 | 949 |
nova-manage cell_v2 simple_cell_setup --transport-url $(get_transport_url) |
| 953 | 950 |
else |