Fix host ID length in VM names table

The host ID length of 36 characters doesn't support the IETF
standards in RFC 1035 section 2.3.1 and RFC 2181 section 11.
This patch is a DB migration to drop the existing table and
recreate it with the proper host length (neutron server
processes will recreate the table afterwards).

Change-Id: Iffbda0a548a4985088c05bf5bb5ae253acdbf338
This commit is contained in:
Thomas Bachman 2019-11-26 23:54:10 +00:00
parent 42acffed6e
commit e9b746b8fc
3 changed files with 45 additions and 2 deletions

View File

@ -0,0 +1,43 @@
# 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.
"""Fix host ID length in VM names table
Revision ID: 24427b3a5c95
Revises: 4f70135dc089
Create Date: 2019-11-26 14:18:11.909757
"""
# revision identifiers, used by Alembic.
revision = '24427b3a5c95'
down_revision = '4f70135dc089'
from alembic import op
import sqlalchemy as sa
def upgrade():
# Just drop and re-create the table - plugin will repopulate it
op.drop_table('apic_aim_vm_name_updates')
op.create_table(
'apic_aim_vm_name_updates',
sa.Column('purpose', sa.String(36), nullable=False),
sa.PrimaryKeyConstraint('purpose'),
sa.Column('host_id', sa.String(255), nullable=False),
sa.Column('last_incremental_update_time', sa.DateTime()),
sa.Column('last_full_update_time', sa.DateTime()),
)
def downgrade():
pass

View File

@ -1 +1 @@
4f70135dc089
24427b3a5c95

View File

@ -117,7 +117,7 @@ class VMNameUpdate(model_base.BASEV2):
__tablename__ = 'apic_aim_vm_name_updates'
purpose = sa.Column(sa.String(36), primary_key=True)
host_id = sa.Column(sa.String(36))
host_id = sa.Column(sa.String(255))
last_incremental_update_time = sa.Column(sa.DateTime)
last_full_update_time = sa.Column(sa.DateTime)