Add ability to switch database driver
Also added mysqlconnector packages into default installation.
blueprint enable-mysql-connector
Change-Id: Ib2cda7cb183dc8f0ff4759cc6e9ecab469fd121c
diff --git a/files/apts/keystone b/files/apts/keystone
index b7218b7..d316a42 100644
--- a/files/apts/keystone
+++ b/files/apts/keystone
@@ -6,6 +6,7 @@
python-pysqlite2
python-sqlalchemy
python-mysqldb
+python-mysql.connector
python-webob
python-greenlet
python-routes
diff --git a/files/apts/neutron b/files/apts/neutron
index 92e0a06..d3a08c7 100644
--- a/files/apts/neutron
+++ b/files/apts/neutron
@@ -15,6 +15,7 @@
python-eventlet
python-sqlalchemy
python-mysqldb
+python-mysql.connector
python-pyudev
python-qpid # dist:precise
dnsmasq-base
diff --git a/files/apts/nova b/files/apts/nova
index e779849..090ca4d 100644
--- a/files/apts/nova
+++ b/files/apts/nova
@@ -6,6 +6,7 @@
iputils-arping
mysql-server # NOPRIME
python-mysqldb
+python-mysql.connector
python-xattr # needed for glance which is needed for nova --- this shouldn't be here
python-lxml # needed for glance which is needed for nova --- this shouldn't be here
gawk
diff --git a/files/rpms-suse/keystone b/files/rpms-suse/keystone
index 403d82f..a734cb9 100644
--- a/files/rpms-suse/keystone
+++ b/files/rpms-suse/keystone
@@ -10,5 +10,6 @@
python-greenlet
python-lxml
python-mysql
+python-mysql.connector
python-pysqlite
sqlite3
diff --git a/files/rpms-suse/neutron b/files/rpms-suse/neutron
index f3bafc7..79f5bff 100644
--- a/files/rpms-suse/neutron
+++ b/files/rpms-suse/neutron
@@ -10,6 +10,7 @@
python-iso8601
python-kombu
python-mysql
+python-mysql.connector
python-Paste
python-PasteDeploy
python-pyudev
diff --git a/files/rpms-suse/nova b/files/rpms-suse/nova
index 7a1160e..2a210e5 100644
--- a/files/rpms-suse/nova
+++ b/files/rpms-suse/nova
@@ -35,6 +35,7 @@
python-lxml # needed for glance which is needed for nova --- this shouldn't be here
python-mox
python-mysql
+python-mysql.connector
python-numpy # needed by websockify for spice console
python-paramiko
python-sqlalchemy-migrate
diff --git a/files/rpms/neutron b/files/rpms/neutron
index f02c02b..aaff48a 100644
--- a/files/rpms/neutron
+++ b/files/rpms/neutron
@@ -4,6 +4,7 @@
ebtables
iptables
iputils
+mysql-connector-python
mysql-server # NOPRIME
openvswitch # NOPRIME
python-boto
diff --git a/files/rpms/nova b/files/rpms/nova
index 6097991..ccee8a7 100644
--- a/files/rpms/nova
+++ b/files/rpms/nova
@@ -15,6 +15,7 @@
libxml2-python
numpy # needed by websockify for spice console
m2crypto
+mysql-connector-python
mysql-server # NOPRIME
parted
polkit
diff --git a/lib/database b/lib/database
index 0661049..e226515 100644
--- a/lib/database
+++ b/lib/database
@@ -89,7 +89,7 @@
# a multi-node DevStack installation.
# NOTE: Don't specify ``/db`` in this string so we can use it for multiple services
- BASE_SQL_CONN=${BASE_SQL_CONN:-${DATABASE_TYPE}://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOST}
+ BASE_SQL_CONN=${BASE_SQL_CONN:-$(get_database_type)://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOST}
return 0
}
@@ -120,6 +120,14 @@
database_connection_url_$DATABASE_TYPE $db
}
+function get_database_type {
+ if [[ -n "${SQLALCHEMY_DATABASE_DRIVER}" ]]; then
+ echo "${DATABASE_TYPE}+${SQLALCHEMY_DATABASE_DRIVER}"
+ else
+ echo "${DATABASE_TYPE}"
+ fi
+}
+
# Restore xtrace
$XTRACE
diff --git a/stackrc b/stackrc
index fb84366..a8467ba 100644
--- a/stackrc
+++ b/stackrc
@@ -52,6 +52,18 @@
ENABLED_SERVICES+=,rabbit,tempest,mysql
fi
+# SQLAlchemy supports multiple database drivers for each database server
+# type. For example, deployer may use MySQLdb, MySQLConnector, or oursql
+# to access MySQL database.
+#
+# When defined, the variable controls which database driver is used to
+# connect to database server. Otherwise using default driver defined for
+# each database type.
+#
+# You can find the list of currently supported drivers for each database
+# type at: http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html
+# SQLALCHEMY_DATABASE_DRIVER="mysqldb"
+
# Global toggle for enabling services under mod_wsgi. If this is set to
# ``True`` all services that use HTTPD + mod_wsgi as the preferred method of
# deployment, will be deployed under Apache. If this is set to ``False`` all