From 5f4b6de23a30999c172e47c11e78739e5bdcfbbf Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Tue, 5 Jun 2012 07:05:35 -0400 Subject: [PATCH] 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 --- stack.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/stack.sh b/stack.sh index 71c2f9eafd..86b9e0ee14 100755 --- a/stack.sh +++ b/stack.sh @@ -1084,17 +1084,23 @@ fi # Quantum service (for controller node) if is_service_enabled q-svc; then - Q_PLUGIN_INI_FILE=/etc/quantum/plugins.ini - Q_CONF_FILE=/etc/quantum/quantum.conf # must remove this file from existing location, otherwise Quantum will prefer it if [[ -e $QUANTUM_DIR/etc/plugins.ini ]]; then + # Support prior to common config + Q_PLUGIN_INI_FILE=/etc/quantum/plugins.ini sudo mv $QUANTUM_DIR/etc/plugins.ini $Q_PLUGIN_INI_FILE fi + Q_CONF_FILE=/etc/quantum/quantum.conf + Q_API_PASTE_FILE=/etc/quantum/api-paste.ini if [[ -e $QUANTUM_DIR/etc/quantum.conf ]]; then sudo mv $QUANTUM_DIR/etc/quantum.conf $Q_CONF_FILE fi + if [[ -e $QUANTUM_DIR/etc/api-paste.ini ]]; then + sudo mv $QUANTUM_DIR/etc/api-paste.ini $Q_API_PASTE_FILE + fi + if is_service_enabled mysql; then mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e "DROP DATABASE IF EXISTS $Q_DB_NAME;" 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 echo "mysql must be enabled in order to use the $Q_PLUGIN Quantum plugin." exit 1 fi - sudo sed -i -e "s/^provider =.*$/provider = $Q_PLUGIN_CLASS/g" $Q_PLUGIN_INI_FILE - screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server $Q_CONF_FILE" + # Update either configuration file with plugin or old plugin file + # file checked below exists only in common config version + if [[ -e $QUANTUM_DIR/quantum/tests/etc/quantum.conf.test ]]; then + sudo sed -i -e "s/^core_plugin =.*$/core_plugin = $Q_PLUGIN_CLASS/g" $Q_CONF_FILE + else + sudo sed -i -e "s/^provider =.*$/provider = $Q_PLUGIN_CLASS/g" $Q_PLUGIN_INI_FILE + fi + + screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server --config-file $Q_CONF_FILE" fi # Quantum agent (for compute nodes)