From f08e9f1f53efa97e07f21ca72a940fcbeb4570e5 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Wed, 20 May 2015 01:03:59 +0000 Subject: [PATCH] Switch from MySQL-python to PyMySQL As discussed in the Liberty Design Summit "Moving apps to Python 3" cross-project workshop, the way forward in the near future is to switch to the pure-python PyMySQL library as a default. https://etherpad.openstack.org/p/liberty-cross-project-python3 Change-Id: I73e0fdb6eca70e7d029a40a2f6f17a7c0797a21d --- etc/neutron.conf | 2 +- etc/neutron/plugins/oneconvergence/nvsdplugin.ini | 2 +- neutron/db/migration/migrate_to_ml2.py | 2 +- neutron/plugins/brocade/README.md | 2 +- neutron/tests/fullstack/base.py | 9 +++++---- neutron/tests/functional/requirements.txt | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/etc/neutron.conf b/etc/neutron.conf index 5b58519d0ea..7a11b939fb5 100755 --- a/etc/neutron.conf +++ b/etc/neutron.conf @@ -708,7 +708,7 @@ admin_password = %SERVICE_PASSWORD% [database] # This line MUST be changed to actually run the plugin. # Example: -# connection = mysql://root:pass@127.0.0.1:3306/neutron +# connection = mysql+pymysql://root:pass@127.0.0.1:3306/neutron # Replace 127.0.0.1 above with the IP address of the database used by the # main neutron server. (Leave it as is if the database runs on this host.) # connection = sqlite:// diff --git a/etc/neutron/plugins/oneconvergence/nvsdplugin.ini b/etc/neutron/plugins/oneconvergence/nvsdplugin.ini index a1c05d971e3..2d8cc77a504 100644 --- a/etc/neutron/plugins/oneconvergence/nvsdplugin.ini +++ b/etc/neutron/plugins/oneconvergence/nvsdplugin.ini @@ -32,4 +32,4 @@ # root_helper = sudo /usr/local/bin/neutron-rootwrap /etc/neutron/rootwrap.conf [database] -# connection = mysql://root:@127.0.0.1/?charset=utf8 +# connection = mysql+pymysql://root:@127.0.0.1/?charset=utf8 diff --git a/neutron/db/migration/migrate_to_ml2.py b/neutron/db/migration/migrate_to_ml2.py index e6c5db332fd..e1b9579bcd5 100755 --- a/neutron/db/migration/migrate_to_ml2.py +++ b/neutron/db/migration/migrate_to_ml2.py @@ -32,7 +32,7 @@ Known Limitations: Example usage: python -m neutron.db.migration.migrate_to_ml2 openvswitch \ - mysql://login:pass@127.0.0.1/neutron + mysql+pymysql://login:pass@127.0.0.1/neutron Note that migration of tunneling state will only be attempted if the --tunnel-type parameter is provided. diff --git a/neutron/plugins/brocade/README.md b/neutron/plugins/brocade/README.md index 82b3ad89d83..1baa3124746 100644 --- a/neutron/plugins/brocade/README.md +++ b/neutron/plugins/brocade/README.md @@ -76,7 +76,7 @@ the configuration file specified in the brocade.ini files: ostype = NOS [database] - connection = mysql://root:pass@localhost/brocade_neutron?charset=utf8 + connection = mysql+pymysql://root:pass@localhost/brocade_neutron?charset=utf8 (please see list of more configuration parameters in the brocade.ini file) diff --git a/neutron/tests/fullstack/base.py b/neutron/tests/fullstack/base.py index 9fed9f3e621..c886bd5e790 100644 --- a/neutron/tests/fullstack/base.py +++ b/neutron/tests/fullstack/base.py @@ -52,10 +52,11 @@ class BaseFullStackTestCase(test_base.MySQLOpportunisticTestCase): we only support MySQL for now, but the groundwork for adding Postgres is already laid. """ - conn = "mysql://%(username)s:%(password)s@127.0.0.1/%(db_name)s" % { - 'username': test_base.DbFixture.USERNAME, - 'password': test_base.DbFixture.PASSWORD, - 'db_name': self.engine.url.database} + conn = ("mysql+pymysql://%(username)s:%(password)s" + "@127.0.0.1/%(db_name)s" % { + 'username': test_base.DbFixture.USERNAME, + 'password': test_base.DbFixture.PASSWORD, + 'db_name': self.engine.url.database}) self.original_conn = cfg.CONF.database.connection self.addCleanup(self._revert_connection_address) diff --git a/neutron/tests/functional/requirements.txt b/neutron/tests/functional/requirements.txt index 0c5f2215b44..2d664cb354a 100644 --- a/neutron/tests/functional/requirements.txt +++ b/neutron/tests/functional/requirements.txt @@ -5,4 +5,4 @@ # process, which may cause wedges in the gate later. psycopg2 -MySQL-python +PyMySQL>=0.6.2 # MIT License