Change data size of instance_id in VNF table
Need to change data size of `instance_id` in the VNF table to
String(12800) from String(64).
We don't have an appropriate ID for instance_id for CNF case, so we use
the object information instead as a workaround.
If it leave the definition of String(64) as it is, a "Data too long for
column" error will occur during CNF operation, because instance_id
store kubernetes object information such as following:
----
'instance_id': "
{'namespace': 'default', 'name': 'vdu1',
'apiVersion': 'apps/v1', 'kind': 'Deployment'},
{'namespace': 'default', 'name': 'pv1',
'apiVersion': 'core/v1', 'kind': 'PersistentVolume'},
... (**Contains the deployed kubernetes resources)
{...}"
----
Reason of changing string size to 12800:
Resize to 12800 so that it can store approximately 100 resources when
it requires 128 characters per resource.
This 12800 characters is under the limit of 65535 bytes per entry,
even for the maximum length character set (4 bytes) [1].
(instance_id's size (12800 * 4) + other total size(3044) < 65535)
`other total size` means the capacity used other than instance_id in
the VNF table.
[1] https://dev.mysql.com/doc/refman/8.0/en/charset-charsets.html
Closes-Bug: 1909011
Change-Id: I50db6f86cd8c164efeab2f0ebbe8ec0258a5ef1d
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
# Copyright 2020 OpenStack Foundation
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
"""change type for instance_id of vnf table
|
||||
|
||||
Revision ID: 7186440a306b
|
||||
Revises: df26c5871f3c
|
||||
Create Date: 2020-12-21 16:08:23.438871
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '7186440a306b'
|
||||
down_revision = 'df26c5871f3c'
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
op.alter_column('vnf',
|
||||
'instance_id',
|
||||
type_=sa.String(length=12800),
|
||||
nullable=True)
|
||||
@@ -1 +1 @@
|
||||
df26c5871f3c
|
||||
7186440a306b
|
||||
|
||||
Reference in New Issue
Block a user