Use DB field sizes instead of _MAX_LEN constants

The following _MAX_LEN constants are being removed from
neutron/api/v2/attributes.py in [1]. The corresponding DB field size
constants from neutron_lib.db.constants should be used instead.
 NAME_MAX_LEN --> NAME_FIELD_SIZE
 TENANT_ID_MAX_LEN --> PROJECT_ID_FIELD_SIZE
 DESCRIPTION_MAX_LEN --> DESCRIPTION_FIELD_SIZE
 LONG_DESCRIPTION_MAX_LEN --> LONG_DESCRIPTION_FIELD_SIZE
 DEVICE_ID_MAX_LEN --> DEVICE_ID_FIELD_SIZE
 DEVICE_OWNER_MAX_LEN --> DEVICE_NAME_FIELD_SIZE
In alembic migration scripts, the raw numerical value shall be used.
For more information, see [2].
[1] https://review.openstack.org/399891
[2] http://lists.openstack.org/pipermail/openstack-dev/2016-October/105789.html
Change-Id: Iebbed80744d2c4ef89d4255ff36cafa19b68bfb6
This commit is contained in:
Henry Gessau
2016年11月26日 00:00:34 -05:00
parent 2e96a8dc2d
commit 9fd1bfd4ce

View File

@@ -20,9 +20,9 @@ import sqlalchemy as sa
from sqlalchemy import orm
from sqlalchemy.orm import exc
from neutron.api.v2 import attributes as attr
from neutron.db import common_db_mixin
from neutron_lib.db import constants as db_const
from neutron_lib.db import model_base
from networking_bgpvpn._i18n import _LI
@@ -35,7 +35,8 @@ LOG = log.getLogger(__name__)
class HasProjectNotNullable(model_base.HasProject):
project_id = sa.Column(sa.String(attr.TENANT_ID_MAX_LEN), index=True,
project_id = sa.Column(sa.String(db_const.PROJECT_ID_FIELD_SIZE),
index=True,
nullable=False)
Reference in New Issue
openstack/networking-bgpvpn
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.