6864N/AThis patchset is for bug:
6864N/A
6864N/A24394567 Mitaka Keystone should support MySQL Cluster
6864N/A
6864N/AThis fixes the following aspects of Keystone:
6864N/A1. Implementation of an oslo.db configuration parameter to specify the MySQL
6864N/A storage engine (mysql_storage_engine).
6864N/A2. Replacement of hardcoded SQL statements that set the engine to "InnoDB"
6864N/A to the above configuration value.
6864N/A3. Logic to handle SQL differences between MySQL InnoDB and MySQL Cluster (NDB).
6864N/A This includes column lengths, constraints, foreign keys, and indexes.
6864N/A
6864N/AThis has not been committed upstream, but has been filed in launchpad:
6864N/A
6864N/Ahttps://bugs.launchpad.net/keystone/+bug/1564110
6864N/A
6864N/A
6864N/A--- keystone-9.1.0/keystone/common/sql/migrate_repo/versions/067_kilo.py.orig 2016-08-04 10:10:34.947867201 -0700
6864N/A+++ keystone-9.1.0/keystone/common/sql/migrate_repo/versions/067_kilo.py 2016-08-04 10:16:37.481333376 -0700
6864N/A@@ -12,6 +12,7 @@
6864N/A
6864N/A
6864N/A import migrate
6864N/A+from oslo_config import cfg
6864N/A from oslo_log import log
6864N/A import sqlalchemy as sql
6864N/A
6864N/A@@ -21,6 +22,7 @@ from keystone.identity.mapping_backends
6864N/A
6864N/A
6864N/A LOG = log.getLogger(__name__)
6864N/A+CONF = cfg.CONF
6864N/A
6864N/A
6864N/A def upgrade(migrate_engine):
6864N/A@@ -44,7 +46,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('blob', ks_sql.JsonBlob, nullable=False),
6864N/A sql.Column('type', sql.String(length=255), nullable=False),
6864N/A sql.Column('extra', ks_sql.JsonBlob.impl),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A domain = sql.Table(
6864N/A@@ -53,7 +55,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('name', sql.String(length=64), nullable=False),
6864N/A sql.Column('enabled', sql.Boolean, default=True, nullable=False),
6864N/A sql.Column('extra', ks_sql.JsonBlob.impl),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A endpoint = sql.Table(
6864N/A@@ -67,7 +69,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('enabled', sql.Boolean, nullable=False, default=True,
6864N/A server_default='1'),
6864N/A sql.Column('region_id', sql.String(length=255), nullable=True),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A group = sql.Table(
6864N/A@@ -77,7 +79,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('name', sql.String(length=64), nullable=False),
6864N/A sql.Column('description', sql.Text),
6864N/A sql.Column('extra', ks_sql.JsonBlob.impl),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A policy = sql.Table(
6864N/A@@ -86,7 +88,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('type', sql.String(length=255), nullable=False),
6864N/A sql.Column('blob', ks_sql.JsonBlob, nullable=False),
6864N/A sql.Column('extra', ks_sql.JsonBlob.impl),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A project = sql.Table(
6864N/A@@ -98,7 +100,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('enabled', sql.Boolean),
6864N/A sql.Column('domain_id', sql.String(length=64), nullable=False),
6864N/A sql.Column('parent_id', sql.String(64), nullable=True),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A role = sql.Table(
6864N/A@@ -106,7 +108,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('id', sql.String(length=64), primary_key=True),
6864N/A sql.Column('name', sql.String(length=255), nullable=False),
6864N/A sql.Column('extra', ks_sql.JsonBlob.impl),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A service = sql.Table(
6864N/A@@ -116,7 +118,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('enabled', sql.Boolean, nullable=False, default=True,
6864N/A server_default='1'),
6864N/A sql.Column('extra', ks_sql.JsonBlob.impl),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A token = sql.Table(
6864N/A@@ -127,7 +129,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('valid', sql.Boolean, default=True, nullable=False),
6864N/A sql.Column('trust_id', sql.String(length=64)),
6864N/A sql.Column('user_id', sql.String(length=64)),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A trust = sql.Table(
6864N/A@@ -141,7 +143,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('expires_at', sql.DateTime),
6864N/A sql.Column('remaining_uses', sql.Integer, nullable=True),
6864N/A sql.Column('extra', ks_sql.JsonBlob.impl),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A trust_role = sql.Table(
6864N/A@@ -150,7 +152,7 @@ def upgrade(migrate_engine):
6864N/A nullable=False),
6864N/A sql.Column('role_id', sql.String(length=64), primary_key=True,
6864N/A nullable=False),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A user = sql.Table(
6864N/A@@ -162,14 +164,14 @@ def upgrade(migrate_engine):
6864N/A sql.Column('enabled', sql.Boolean),
6864N/A sql.Column('domain_id', sql.String(length=64), nullable=False),
6864N/A sql.Column('default_project_id', sql.String(length=64)),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A user_group_membership = sql.Table(
6864N/A 'user_group_membership', meta,
6864N/A sql.Column('user_id', sql.String(length=64), primary_key=True),
6864N/A sql.Column('group_id', sql.String(length=64), primary_key=True),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A region = sql.Table(
6864N/A@@ -179,7 +181,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('description', sql.String(255), nullable=False),
6864N/A sql.Column('parent_region_id', sql.String(255), nullable=True),
6864N/A sql.Column('extra', sql.Text()),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A assignment = sql.Table(
6864N/A@@ -197,7 +199,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('role_id', sql.String(64), nullable=False),
6864N/A sql.Column('inherited', sql.Boolean, default=False, nullable=False),
6864N/A sql.PrimaryKeyConstraint('type', 'actor_id', 'target_id', 'role_id'),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A mapping = sql.Table(
6864N/A@@ -211,7 +213,7 @@ def upgrade(migrate_engine):
6864N/A mapping_backend.EntityType.GROUP,
6864N/A name='entity_type'),
6864N/A nullable=False),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A domain_config_whitelist = sql.Table(
6864N/A@@ -221,7 +223,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('group', sql.String(255), primary_key=True),
6864N/A sql.Column('option', sql.String(255), primary_key=True),
6864N/A sql.Column('value', ks_sql.JsonBlob.impl, nullable=False),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A domain_config_sensitive = sql.Table(
6864N/A@@ -231,7 +233,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('group', sql.String(255), primary_key=True),
6864N/A sql.Column('option', sql.String(255), primary_key=True),
6864N/A sql.Column('value', ks_sql.JsonBlob.impl, nullable=False),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A # create all tables
6864N/A--- keystone-9.1.0/keystone/common/sql/migrate_repo/versions/073_insert_assignment_inherited_pk.py.orig 2016-08-04 10:10:40.619013471 -0700
6864N/A+++ keystone-9.1.0/keystone/common/sql/migrate_repo/versions/073_insert_assignment_inherited_pk.py 2016-08-04 10:18:06.349087340 -0700
6864N/A@@ -11,11 +11,13 @@
6864N/A # under the License.
6864N/A
6864N/A import migrate
6864N/A+from oslo_config import cfg
6864N/A import sqlalchemy as sql
6864N/A from sqlalchemy.orm import sessionmaker
6864N/A
6864N/A from keystone.assignment.backends import sql as assignment_sql
6864N/A
6864N/A+CONF = cfg.CONF
6864N/A
6864N/A def upgrade(migrate_engine):
6864N/A """Inserts inherited column to assignment table PK constraints.
6864N/A@@ -57,7 +59,7 @@ def upgrade(migrate_engine):
6864N/A nullable=False),
6864N/A sql.PrimaryKeyConstraint('type', 'actor_id', 'target_id',
6864N/A 'role_id', 'inherited'),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A # Create the new assignment table
6864N/A--- keystone-9.1.0/keystone/common/sql/migrate_repo/versions/075_confirm_config_registration.py.orig 2016-08-04 10:10:47.746776861 -0700
6864N/A+++ keystone-9.1.0/keystone/common/sql/migrate_repo/versions/075_confirm_config_registration.py 2016-08-04 10:19:03.802564813 -0700
6864N/A@@ -10,9 +10,11 @@
6864N/A # License for the specific language governing permissions and limitations
6864N/A # under the License.
6864N/A
6864N/A+from oslo_config import cfg
6864N/A import sqlalchemy as sql
6864N/A
6864N/A REGISTRATION_TABLE = 'config_register'
6864N/A+CONF = cfg.CONF
6864N/A
6864N/A
6864N/A def upgrade(migrate_engine):
6864N/A@@ -24,6 +26,6 @@ def upgrade(migrate_engine):
6864N/A meta,
6864N/A sql.Column('type', sql.String(64), primary_key=True),
6864N/A sql.Column('domain_id', sql.String(64), nullable=False),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A registration_table.create(migrate_engine, checkfirst=True)
6864N/A--- keystone-9.1.0/keystone/common/sql/migrate_repo/versions/081_add_endpoint_policy_table.py.orig 2016-08-04 10:10:53.258335033 -0700
6864N/A+++ keystone-9.1.0/keystone/common/sql/migrate_repo/versions/081_add_endpoint_policy_table.py 2016-08-04 10:20:06.575865756 -0700
6864N/A@@ -12,10 +12,12 @@
6864N/A # License for the specific language governing permissions and limitations
6864N/A # under the License.
6864N/A
6864N/A+from oslo_config import cfg
6864N/A import sqlalchemy as sql
6864N/A
6864N/A from keystone.common.sql import migration_helpers
6864N/A
6864N/A+CONF = cfg.CONF
6864N/A
6864N/A def upgrade(migrate_engine):
6864N/A try:
6864N/A@@ -48,7 +50,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('region_id', sql.String(64),
6864N/A nullable=True),
6864N/A sql.UniqueConstraint('endpoint_id', 'service_id', 'region_id'),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A
6864N/A endpoint_policy_table.create(migrate_engine, checkfirst=True)
6864N/A--- keystone-9.1.0/keystone/common/sql/migrate_repo/versions/082_add_federation_tables.py.orig 2016-08-04 10:10:59.098720956 -0700
6864N/A+++ keystone-9.1.0/keystone/common/sql/migrate_repo/versions/082_add_federation_tables.py 2016-08-04 10:22:41.994100588 -0700
6864N/A@@ -45,7 +45,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('id', sql.String(64), primary_key=True),
6864N/A sql.Column('enabled', sql.Boolean, nullable=False),
6864N/A sql.Column('description', sql.Text(), nullable=True),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A idp_table.create(migrate_engine, checkfirst=True)
6864N/A
6864N/A@@ -57,7 +57,7 @@ def upgrade(migrate_engine):
6864N/A sql.ForeignKey('identity_provider.id', ondelete='CASCADE'),
6864N/A primary_key=True),
6864N/A sql.Column('mapping_id', sql.String(64), nullable=False),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A federation_protocol_table.create(migrate_engine, checkfirst=True)
6864N/A
6864N/A@@ -66,7 +66,7 @@ def upgrade(migrate_engine):
6864N/A meta,
6864N/A sql.Column('id', sql.String(64), primary_key=True),
6864N/A sql.Column('rules', sql.Text(), nullable=False),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A mapping_table.create(migrate_engine, checkfirst=True)
6864N/A
6864N/A@@ -81,7 +81,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('sp_url', sql.String(256), nullable=False),
6864N/A sql.Column(_RELAY_STATE_PREFIX, sql.String(256), nullable=False,
6864N/A server_default=relay_state_prefix_default),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A sp_table.create(migrate_engine, checkfirst=True)
6864N/A
6864N/A@@ -92,6 +92,6 @@ def upgrade(migrate_engine):
6864N/A sql.Column('idp_id', sql.String(64),
6864N/A sql.ForeignKey('identity_provider.id', ondelete='CASCADE')),
6864N/A sql.Column('remote_id', sql.String(255), primary_key=True),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A remote_id_table.create(migrate_engine, checkfirst=True)
6864N/A--- keystone-9.1.0/keystone/common/sql/migrate_repo/versions/087_implied_roles.py.orig 2016-08-04 10:11:04.322293468 -0700
6864N/A+++ keystone-9.1.0/keystone/common/sql/migrate_repo/versions/087_implied_roles.py 2016-08-04 10:23:34.919749416 -0700
6864N/A@@ -12,10 +12,12 @@
6864N/A
6864N/A
6864N/A import migrate
6864N/A+from oslo_config import cfg
6864N/A import sqlalchemy as sql
6864N/A
6864N/A
6864N/A ROLE_TABLE = 'role'
6864N/A+CONF = cfg.CONF
6864N/A
6864N/A
6864N/A def upgrade(migrate_engine):
6864N/A@@ -27,7 +29,7 @@ def upgrade(migrate_engine):
6864N/A sql.Column('prior_role_id', sql.String(length=64), primary_key=True),
6864N/A sql.Column(
6864N/A 'implied_role_id', sql.String(length=64), primary_key=True),
6864N/A- mysql_engine='InnoDB',
6864N/A+ mysql_engine=CONF.database.mysql_storage_engine,
6864N/A mysql_charset='utf8')
6864N/A implied_role.create()
6864N/A role = sql.Table(ROLE_TABLE, meta, autoload=True)