Enables MySQL Cluster Support for Magnum
This enables the usage of the mysql_enable_ndb setting in oslo_db from bug 1564110. This allows operators to select from MySQL (InnoDB) or MySQL Cluster (NDB) as the storage engine backend. There are only two tables that need to have their columns auto adjusted to fit with in the 14k row width limit of NDB, cluster and cluster_templates. The modifications here will have zero affect on users of MySQL (InnoDB). Additionally, this fix will auto adjust those tables in models.py module to support this enhancement. Closes-Bug: 1691514 Change-Id: Ia0584059f998baf3db4a44bccbb6f6ff8a058ae1 Depends-On: I7f9c830073bf9a30abce0aa4bb55b5c9cf661afe
This commit is contained in:
parent
0ae8b16a49
commit
0e6e27eb7a
|
@ -23,9 +23,14 @@ revision = '05d3e97de9ee'
|
|||
down_revision = '57fbdf2327a2'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from oslo_db.sqlalchemy.types import String
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy.dialects.mysql import TINYTEXT
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('baymodel', sa.Column('volume_driver',
|
||||
sa.String(length=255), nullable=True))
|
||||
String(255, mysql_ndb_type=TINYTEXT), nullable=True))
|
||||
|
|
|
@ -24,8 +24,13 @@ revision = '2581ebaf0cb2'
|
|||
down_revision = None
|
||||
|
||||
from alembic import op
|
||||
|
||||
from oslo_db.sqlalchemy.types import String
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy.dialects.mysql import TINYTEXT
|
||||
|
||||
|
||||
def upgrade():
|
||||
# commands auto generated by Alembic - please adjust!
|
||||
|
@ -56,7 +61,8 @@ def upgrade():
|
|||
sa.Column('keypair_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('image_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('external_network_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('dns_nameserver', sa.String(length=255), nullable=True),
|
||||
sa.Column('dns_nameserver', String(255, mysql_ndb_type=TINYTEXT),
|
||||
nullable=True),
|
||||
sa.Column('apiserver_port', sa.Integer(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_ENGINE='InnoDB',
|
||||
|
|
|
@ -24,9 +24,15 @@ revision = '35cff7c86221'
|
|||
down_revision = '3a938526b35d'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from oslo_db.sqlalchemy.types import String
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy.dialects.mysql import TINYTEXT
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('baymodel', sa.Column('fixed_network', sa.String(length=255),
|
||||
op.add_column('baymodel', sa.Column('fixed_network',
|
||||
String(255, mysql_ndb_type=TINYTEXT),
|
||||
nullable=True))
|
||||
|
|
|
@ -26,9 +26,14 @@ revision = '3be65537a94a'
|
|||
down_revision = '4e263f236334'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from oslo_db.sqlalchemy.types import String
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy.dialects.mysql import TINYTEXT
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('baymodel', sa.Column('network_driver',
|
||||
sa.String(length=255), nullable=True))
|
||||
String(255, mysql_ndb_type=TINYTEXT), nullable=True))
|
||||
|
|
|
@ -23,9 +23,14 @@ revision = '4956f03cabad'
|
|||
down_revision = '2d8657c0cdc'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from oslo_db.sqlalchemy.types import String
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy.dialects.mysql import TINYTEXT
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('baymodel', sa.Column('cluster_distro',
|
||||
sa.String(length=255), nullable=True))
|
||||
String(255, mysql_ndb_type=TINYTEXT), nullable=True))
|
||||
|
|
|
@ -22,10 +22,16 @@ revision = '4ea34a59a64c'
|
|||
down_revision = '456126c6c9e9'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from oslo_db.sqlalchemy.types import String
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy.dialects.mysql import TINYTEXT
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('bay',
|
||||
sa.Column('discovery_url', sa.String(length=255),
|
||||
sa.Column('discovery_url',
|
||||
String(255, mysql_ndb_type=TINYTEXT),
|
||||
nullable=True))
|
||||
|
|
|
@ -22,17 +22,22 @@ revision = '5518af8dbc21'
|
|||
down_revision = '6f21dc920bb'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from oslo_db.sqlalchemy.types import String
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy.dialects.mysql import TEXT
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('bay', 'ca_cert_uuid',
|
||||
new_column_name='ca_cert_ref',
|
||||
existing_type=sa.String(length=36),
|
||||
type_=sa.String(length=512),
|
||||
type_=String(512, mysql_ndb_type=TEXT),
|
||||
nullable=True)
|
||||
op.alter_column('bay', 'magnum_cert_uuid',
|
||||
new_column_name='magnum_cert_ref',
|
||||
existing_type=sa.String(length=36),
|
||||
type_=sa.String(length=512),
|
||||
type_=String(512, mysql_ndb_type=TEXT),
|
||||
nullable=True)
|
||||
|
|
|
@ -24,18 +24,24 @@ down_revision = '4956f03cabad'
|
|||
|
||||
from alembic import op
|
||||
|
||||
from oslo_db.sqlalchemy.types import String
|
||||
|
||||
import magnum.conf
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy.dialects.mysql import TINYTEXT
|
||||
|
||||
CONF = magnum.conf.CONF
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('baymodel', sa.Column('coe', sa.String(length=255),
|
||||
op.add_column('baymodel', sa.Column('coe', String(255,
|
||||
mysql_ndb_type=TINYTEXT),
|
||||
nullable=True))
|
||||
|
||||
baymodel = sa.sql.table('baymodel',
|
||||
sa.sql.column('coe', sa.String(length=255)))
|
||||
sa.sql.column('coe', String(255,
|
||||
mysql_ndb_type=TINYTEXT)))
|
||||
|
||||
op.execute(
|
||||
baymodel.update().values({
|
||||
|
|
|
@ -26,16 +26,23 @@ revision = '5d4caa6e0a42'
|
|||
down_revision = 'bb42b7cad130'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from oslo_db.sqlalchemy.types import String
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy.dialects.mysql import TINYTEXT
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('bay', 'registry_trust_id',
|
||||
new_column_name='trust_id',
|
||||
existing_type=sa.String(255))
|
||||
op.add_column('bay', sa.Column('trustee_username',
|
||||
sa.String(length=255), nullable=True))
|
||||
String(255, mysql_ndb_type=TINYTEXT),
|
||||
nullable=True))
|
||||
op.add_column('bay', sa.Column('trustee_user_id',
|
||||
sa.String(length=255), nullable=True))
|
||||
op.add_column('bay', sa.Column('trustee_password',
|
||||
sa.String(length=255), nullable=True))
|
||||
String(255, mysql_ndb_type=TINYTEXT),
|
||||
nullable=True))
|
||||
|
|
|
@ -22,13 +22,21 @@ revision = '966a99e70ff'
|
|||
down_revision = '6f21dc998bb'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from oslo_db.sqlalchemy.types import String
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy.dialects.mysql import TINYTEXT
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('baymodel', sa.Column('http_proxy',
|
||||
sa.String(length=255), nullable=True))
|
||||
String(255, mysql_ndb_type=TINYTEXT),
|
||||
nullable=True))
|
||||
op.add_column('baymodel', sa.Column('https_proxy',
|
||||
sa.String(length=255), nullable=True))
|
||||
String(255, mysql_ndb_type=TINYTEXT),
|
||||
nullable=True))
|
||||
op.add_column('baymodel', sa.Column('no_proxy',
|
||||
sa.String(length=255), nullable=True))
|
||||
String(255, mysql_ndb_type=TINYTEXT),
|
||||
nullable=True))
|
||||
|
|
|
@ -22,9 +22,15 @@ revision = 'e0653b2d5271'
|
|||
down_revision = '68ce16dfd341'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from oslo_db.sqlalchemy.types import String
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy.dialects.mysql import TINYTEXT
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('baymodel', sa.Column('fixed_subnet',
|
||||
sa.String(length=255), nullable=True))
|
||||
String(255, mysql_ndb_type=TINYTEXT),
|
||||
nullable=True))
|
||||
|
|
|
@ -22,9 +22,15 @@ revision = 'e647f5931da8'
|
|||
down_revision = '049f81f6f584'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from oslo_db.sqlalchemy.types import String
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy.dialects.mysql import TINYTEXT
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('baymodel', sa.Column('insecure_registry',
|
||||
sa.String(length=255), nullable=True))
|
||||
String(255, mysql_ndb_type=TINYTEXT),
|
||||
nullable=True))
|
||||
|
|
|
@ -22,13 +22,20 @@ revision = 'fcb4efee8f8b'
|
|||
down_revision = 'b1f612248cab'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from oslo_db.sqlalchemy.types import String
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy.dialects.mysql import TINYTEXT
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('bay',
|
||||
sa.Column('coe_version', sa.String(length=255),
|
||||
sa.Column('coe_version', String(255,
|
||||
mysql_ndb_type=TINYTEXT),
|
||||
nullable=True))
|
||||
op.add_column('bay',
|
||||
sa.Column('container_version', sa.String(length=255),
|
||||
sa.Column('container_version', String(255,
|
||||
mysql_ndb_type=TINYTEXT),
|
||||
nullable=True))
|
||||
|
|
|
@ -19,6 +19,7 @@ SQLAlchemy models for container service
|
|||
import json
|
||||
|
||||
from oslo_db.sqlalchemy import models
|
||||
from oslo_db.sqlalchemy.types import String
|
||||
import six.moves.urllib.parse as urlparse
|
||||
from sqlalchemy import Boolean
|
||||
from sqlalchemy import Column
|
||||
|
@ -26,9 +27,10 @@ from sqlalchemy import DateTime
|
|||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy import Integer
|
||||
from sqlalchemy import schema
|
||||
from sqlalchemy import String
|
||||
from sqlalchemy import Text
|
||||
from sqlalchemy.types import TypeDecorator, TEXT
|
||||
from sqlalchemy.dialects.mysql import TEXT as mysql_TEXT
|
||||
from sqlalchemy.dialects.mysql import TINYTEXT
|
||||
|
||||
import magnum.conf
|
||||
|
||||
|
@ -127,24 +129,24 @@ class Cluster(Base):
|
|||
status = Column(String(20))
|
||||
status_reason = Column(Text)
|
||||
create_timeout = Column(Integer())
|
||||
discovery_url = Column(String(255))
|
||||
discovery_url = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
master_addresses = Column(JSONEncodedList)
|
||||
# TODO(wanghua): encrypt trust_id in db
|
||||
trust_id = Column(String(255))
|
||||
trustee_username = Column(String(255))
|
||||
trustee_username = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
trustee_user_id = Column(String(255))
|
||||
# TODO(wanghua): encrypt trustee_password in db
|
||||
trustee_password = Column(String(255))
|
||||
coe_version = Column(String(255))
|
||||
container_version = Column(String(255))
|
||||
trustee_password = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
coe_version = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
container_version = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
# (yuanying) if we use barbican,
|
||||
# cert_ref size is determined by below format
|
||||
# * http(s)://${DOMAIN_NAME}/v1/containers/${UUID}
|
||||
# as a result, cert_ref length is estimated to 312 chars.
|
||||
# but we can use another backend to store certs.
|
||||
# so, we use 512 chars to get some buffer.
|
||||
ca_cert_ref = Column(String(512))
|
||||
magnum_cert_ref = Column(String(512))
|
||||
ca_cert_ref = Column(String(512, mysql_ndb_type=mysql_TEXT))
|
||||
magnum_cert_ref = Column(String(512, mysql_ndb_type=mysql_TEXT))
|
||||
|
||||
|
||||
class ClusterTemplate(Base):
|
||||
|
@ -165,25 +167,25 @@ class ClusterTemplate(Base):
|
|||
master_flavor_id = Column(String(255))
|
||||
keypair_id = Column(String(255))
|
||||
external_network_id = Column(String(255))
|
||||
fixed_network = Column(String(255))
|
||||
fixed_subnet = Column(String(255))
|
||||
network_driver = Column(String(255))
|
||||
volume_driver = Column(String(255))
|
||||
dns_nameserver = Column(String(255))
|
||||
fixed_network = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
fixed_subnet = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
network_driver = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
volume_driver = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
dns_nameserver = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
apiserver_port = Column(Integer())
|
||||
docker_volume_size = Column(Integer())
|
||||
docker_storage_driver = Column(String(255))
|
||||
cluster_distro = Column(String(255))
|
||||
coe = Column(String(255))
|
||||
http_proxy = Column(String(255))
|
||||
https_proxy = Column(String(255))
|
||||
no_proxy = Column(String(255))
|
||||
cluster_distro = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
coe = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
http_proxy = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
https_proxy = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
no_proxy = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
registry_enabled = Column(Boolean, default=False)
|
||||
labels = Column(JSONEncodedDict)
|
||||
tls_disabled = Column(Boolean, default=False)
|
||||
public = Column(Boolean, default=False)
|
||||
server_type = Column(String(255))
|
||||
insecure_registry = Column(String(255))
|
||||
insecure_registry = Column(String(255, mysql_ndb_type=TINYTEXT))
|
||||
master_lb_enabled = Column(Boolean, default=False)
|
||||
floating_ip_enabled = Column(Boolean, default=True)
|
||||
|
||||
|
|
Loading…
Reference in New Issue