From bb49d35739b6375202a4ff23d49fdced6693472c Mon Sep 17 00:00:00 2001
From: Dan Smith <dansmith@redhat.com>
Date: Mon, 28 Mar 2016 11:03:35 -0700
Subject: [PATCH] Run online_data_migrations during nova setup

This is a normal step in the process for upgrade and is now
required for migration of flavors from the main DB to the API DB.
Since we previously made a bad decision to encode those flavors into
the first database migration, that means that even on new installs we
need to run these.

Deployment tools are going to be running this command any time they
do anything to the database post-deployment, which means adding this
to devstack is putting it in line with what normal deployments will
be doing.

Change-Id: I8ab03af9d2f4974f26a7f8487ec978caea957e45
---
 lib/nova | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/nova b/lib/nova
index 2b8fefaf00..602a6ef8cf 100644
--- a/lib/nova
+++ b/lib/nova
@@ -708,6 +708,10 @@ function init_nova {
 
         recreate_database $NOVA_API_DB
         $NOVA_BIN_DIR/nova-manage api_db sync
+
+        # Run online migrations on the new databases
+        # Needed for flavor conversion
+        $NOVA_BIN_DIR/nova-manage db online_data_migrations
     fi
 
     create_nova_cache_dir