Browse code

Quantum common configuration support. This ensures that devstack will work with the Quantum versions and ini files prior to, and after, the above mentioned changes.

Change-Id: I18da8febf808c4752330ad1699a079c1d0a544fa

Gary Kotton authored on 2012/06/05 20:05:35
Showing 1 changed files
... ...
@@ -1084,17 +1084,23 @@ fi
1084 1084
 
1085 1085
 # Quantum service (for controller node)
1086 1086
 if is_service_enabled q-svc; then
1087
-    Q_PLUGIN_INI_FILE=/etc/quantum/plugins.ini
1088
-    Q_CONF_FILE=/etc/quantum/quantum.conf
1089 1087
     # must remove this file from existing location, otherwise Quantum will prefer it
1090 1088
     if [[ -e $QUANTUM_DIR/etc/plugins.ini ]]; then
1089
+        # Support prior to common config
1090
+        Q_PLUGIN_INI_FILE=/etc/quantum/plugins.ini
1091 1091
         sudo mv $QUANTUM_DIR/etc/plugins.ini $Q_PLUGIN_INI_FILE
1092 1092
     fi
1093
+    Q_CONF_FILE=/etc/quantum/quantum.conf
1094
+    Q_API_PASTE_FILE=/etc/quantum/api-paste.ini
1093 1095
 
1094 1096
     if [[ -e $QUANTUM_DIR/etc/quantum.conf ]]; then
1095 1097
       sudo mv $QUANTUM_DIR/etc/quantum.conf $Q_CONF_FILE
1096 1098
     fi
1097 1099
 
1100
+    if [[ -e $QUANTUM_DIR/etc/api-paste.ini ]]; then
1101
+      sudo mv $QUANTUM_DIR/etc/api-paste.ini $Q_API_PASTE_FILE
1102
+    fi
1103
+
1098 1104
     if is_service_enabled mysql; then
1099 1105
             mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e "DROP DATABASE IF EXISTS $Q_DB_NAME;"
1100 1106
             mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e "CREATE DATABASE IF NOT EXISTS $Q_DB_NAME CHARACTER SET utf8;"
... ...
@@ -1102,9 +1108,16 @@ if is_service_enabled q-svc; then
1102 1102
             echo "mysql must be enabled in order to use the $Q_PLUGIN Quantum plugin."
1103 1103
             exit 1
1104 1104
     fi
1105
-    sudo sed -i -e "s/^provider =.*$/provider = $Q_PLUGIN_CLASS/g" $Q_PLUGIN_INI_FILE
1106 1105
 
1107
-    screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server $Q_CONF_FILE"
1106
+    # Update either configuration file with plugin or old plugin file
1107
+    # file checked below exists only in common config version
1108
+    if [[ -e $QUANTUM_DIR/quantum/tests/etc/quantum.conf.test ]]; then
1109
+        sudo sed -i -e "s/^core_plugin =.*$/core_plugin = $Q_PLUGIN_CLASS/g" $Q_CONF_FILE
1110
+    else
1111
+        sudo sed -i -e "s/^provider =.*$/provider = $Q_PLUGIN_CLASS/g" $Q_PLUGIN_INI_FILE
1112
+    fi
1113
+
1114
+    screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server --config-file $Q_CONF_FILE"
1108 1115
 fi
1109 1116
 
1110 1117
 # Quantum agent (for compute nodes)