Browse code

Merge "Run Neutron migrations after creating schema"

Jenkins authored on 2013/08/07 02:14:10
Showing 2 changed files
... ...
@@ -367,7 +367,9 @@ function create_neutron_initial_network() {
367 367
 
368 368
 # init_neutron() - Initialize databases, etc.
369 369
 function init_neutron() {
370
-    :
370
+    recreate_database $Q_DB_NAME utf8
371
+    # Run Neutron db migrations
372
+    $NEUTRON_BIN_DIR/neutron-db-manage --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head
371 373
 }
372 374
 
373 375
 # install_neutron() - Collect source and prepare
... ...
@@ -614,12 +616,6 @@ function _configure_neutron_service() {
614 614
     cp $NEUTRON_DIR/etc/api-paste.ini $Q_API_PASTE_FILE
615 615
     cp $NEUTRON_DIR/etc/policy.json $Q_POLICY_FILE
616 616
 
617
-    if is_service_enabled $DATABASE_BACKENDS; then
618
-        recreate_database $Q_DB_NAME utf8
619
-    else
620
-        die $LINENO "A database must be enabled in order to use the $Q_PLUGIN Neutron plugin."
621
-    fi
622
-
623 617
     # Update either configuration file with plugin
624 618
     iniset $NEUTRON_CONF DEFAULT core_plugin $Q_PLUGIN_CLASS
625 619
 
... ...
@@ -939,7 +939,10 @@ if is_service_enabled neutron; then
939 939
     echo_summary "Configuring Neutron"
940 940
 
941 941
     configure_neutron
942
-    init_neutron
942
+    # Run init_neutron only on the node hosting the neutron API server
943
+    if is_service_enabled $DATABASE_BACKENDS && is_service_enabled q-svc; then
944
+        init_neutron
945
+    fi
943 946
 fi
944 947
 
945 948
 # Some Neutron plugins require network controllers which are not