Fix metadef tags migrations

Adds new migration to fix an issue with an index created by
mysql.

Also includes patch I00da67ab06cd0a3c46aa8a6cd815d0559408c2f0,
because without it tests won't pass.

Change-Id: Iffb54d5ee404889d49c40dbe0401d61e55723872
Co-Authored-By: Mike Fedosin <mfedosin@mirantis.com>
Co-Authored-By: Andreas Jaeger <aj@suse.de>
Co-Authored-By: Oleksii Chuprykov <ochuprykov@mirantis.com>
This commit is contained in:
Mike Fedosin 2015-03-24 15:58:08 +03:00
parent 232a8786dd
commit 401e35e152
4 changed files with 54 additions and 19 deletions

View File

@ -0,0 +1,24 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import sqlalchemy
from sqlalchemy import (Table, Index)
def upgrade(migrate_engine):
if migrate_engine.name == 'mysql':
meta = sqlalchemy.MetaData()
meta.bind = migrate_engine
metadef_tags = Table('metadef_tags', meta, autoload=True)
Index('namespace_id', metadef_tags.c.namespace_id,
metadef_tags.c.name).drop()

View File

@ -90,7 +90,8 @@ class MigrationsMixin(test_migrations.WalkVersionsMixin):
return self.engine
def test_walk_versions(self):
self._walk_versions(True, False)
# No more downgrades
self._walk_versions(False, False)
def _create_unversioned_001_db(self, engine):
# Create the initial version of the images table
@ -1485,6 +1486,15 @@ class MigrationsMixin(test_migrations.WalkVersionsMixin):
self.assertTrue(unique_constraint_exist(
'name', metadef_resource_types.name, engine))
def _check_040(self, engine, data):
meta = sqlalchemy.MetaData()
meta.bind = engine
metadef_tags = sqlalchemy.Table('metadef_tags', meta, autoload=True)
if engine.name == 'mysql':
self.assertFalse(index_exist('namespace_id',
metadef_tags.name, engine))
class TestMysqlMigrations(test_base.MySQLOpportunisticTestCase,
MigrationsMixin):
@ -1518,7 +1528,8 @@ class TestPostgresqlMigrations(test_base.PostgreSQLOpportunisticTestCase,
class TestSqliteMigrations(test_base.DbTestCase,
MigrationsMixin):
def test_walk_versions(self):
self._walk_versions(True, True)
# No more downgrades
self._walk_versions(False, False)
class ModelsMigrationSyncMixin(object):

View File

@ -12,7 +12,7 @@ greenlet>=0.3.2
# < 0.8.0/0.8 does not work, see https://bugs.launchpad.net/bugs/1153983
SQLAlchemy>=0.9.7,<=0.9.99
anyjson>=0.3.3
eventlet>=0.16.1
eventlet>=0.16.1,!=0.17.0
PasteDeploy>=1.5.0
Routes>=1.12.3,!=2.0
WebOb>=1.2.3
@ -22,13 +22,13 @@ kombu>=2.5.0
pycrypto>=2.6
iso8601>=0.1.9
ordereddict
oslo.config>=1.9.0 # Apache-2.0
oslo.concurrency>=1.4.1 # Apache-2.0
oslo.context>=0.2.0 # Apache-2.0
oslo.utils>=1.2.0 # Apache-2.0
stevedore>=1.1.0 # Apache-2.0
taskflow>=0.6
keystonemiddleware>=1.0.0
oslo.config>=1.9.3,<1.10.0 # Apache-2.0
oslo.concurrency>=1.8.0,<1.9.0 # Apache-2.0
oslo.context>=0.2.0,<0.3.0 # Apache-2.0
oslo.utils>=1.4.0,<1.5.0 # Apache-2.0
stevedore>=1.3.0,<1.4.0 # Apache-2.0
taskflow>=0.7.1,<0.8.0
keystonemiddleware>=1.5.0
WSME>=0.6
# For openstack/common/lockutils
posix_ipc
@ -37,7 +37,7 @@ posix_ipc
python-swiftclient>=2.2.0
# For VMware storage backed.
oslo.vmware>=0.11.0 # Apache-2.0
oslo.vmware>=0.11.1,<0.12.0 # Apache-2.0
# For paste.util.template used in keystone.common.template
Paste
@ -49,12 +49,12 @@ semantic_version>=2.3.1
# Required by openstack.common libraries
six>=1.9.0
oslo.db>=1.5.0 # Apache-2.0
oslo.i18n>=1.3.0 # Apache-2.0
oslo.log>=0.4.0 # Apache-2.0
oslo.messaging>=1.6.0 # Apache-2.0
oslo.policy~=0.3.1 # Apache-2.0
oslo.serialization>=1.2.0 # Apache-2.0
oslo.db>=1.7.0,<1.8.0 # Apache-2.0
oslo.i18n>=1.5.0,<1.6.0 # Apache-2.0
oslo.log>=1.0.0,<1.1.0 # Apache-2.0
oslo.messaging>=1.8.0,<1.9.0 # Apache-2.0
oslo.policy>=0.3.1,<0.4.0 # Apache-2.0
oslo.serialization>=1.4.0,<1.5.0 # Apache-2.0
retrying>=1.2.3,!=1.3.0 # Apache-2.0
osprofiler>=0.3.0 # Apache-2.0

View File

@ -19,7 +19,7 @@ requests>=2.2.0,!=2.4.0
testrepository>=0.0.18
testtools>=0.9.36,!=1.2.0
psutil>=1.1.1,<2.0.0
oslotest>=1.2.0 # Apache-2.0
oslotest>=1.5.1,<1.6.0 # Apache-2.0
# Optional packages that should be installed when testing
MySQL-python
psycopg2
@ -28,4 +28,4 @@ qpid-python
xattr>=0.4
# Documentation
oslosphinx>=2.2.0 # Apache-2.0
oslosphinx>=2.5.0,<2.6.0 # Apache-2.0