ID should be biginteger in resource routing table

1. What is the problem?
Currently the id in resource routing table is integer, the scope of integer is
very limited, so it should be replaced with biginteger.

2. What is the solution to the problem?
Replacing the integer with biginteger will fix this problem. What's more,
API documentation should be updated at the same time.

3. What the features need to be implemented to the Tricircle to realize
the solution?
None.

Change-Id: I2be59348965fb21b6865a3646fa7201b62e46d02
Closes-Bug: #1647513
This commit is contained in:
Dongfeng Huang 2016-12-07 09:30:05 +08:00
parent 421fb26a4d
commit 1533bb0f51
3 changed files with 15 additions and 11 deletions

View File

@ -583,7 +583,7 @@ attributes are described in the following table.
+-------------+-------+---------------+-----------------------------------------------------+
|Name |In | Type | Description |
+=============+=======+===============+=====================================================+
|id |body | uuid |id is the unique identification of the resource |
|id |body | biginteger |id is the unique identification of the resource |
| | | |routing. |
+-------------+-------+---------------+-----------------------------------------------------+
|top_id |body | string |top_id denotes the resource id on central Neutron. |
@ -672,7 +672,7 @@ Normal Response Code: 200
+-------------+-------+---------------+-----------------------------------------------------+
|Name |In | Type | Description |
+=============+=======+===============+=====================================================+
|id |path | uuid |id is the unique identification of the resource |
|id |path | biginteger |id is the unique identification of the resource |
| | | |routing. |
+-------------+-------+---------------+-----------------------------------------------------+
@ -686,7 +686,7 @@ table.
+-------------+-------+---------------+-----------------------------------------------------+
|Name |In | Type | Description |
+=============+=======+===============+=====================================================+
|id |body | uuid |id is the unique identification of the resource |
|id |body | biginteger |id is the unique identification of the resource |
| | | |routing. |
+-------------+-------+---------------+-----------------------------------------------------+
|top_id |body | string |top_id denotes the resource id on central Neutron. |
@ -769,7 +769,7 @@ entry's attributes are listed below.
+-------------+-------+---------------+-----------------------------------------------------+
|Name |In | Type | Description |
+=============+=======+===============+=====================================================+
|id |body | uuid |id is the unique identification of the resource |
|id |body | biginteger |id is the unique identification of the resource |
| | | |routing. |
+-------------+-------+---------------+-----------------------------------------------------+
|top_id |body | string |top_id denotes the resource id on central Neutron. |
@ -844,7 +844,7 @@ Normal Response Code: 200
+-------------+-------+---------------+-----------------------------------------------------+
|Name |In | Type | Description |
+=============+=======+===============+=====================================================+
|id |path | uuid |id is the unique identification of the resource |
|id |path | biginteger |id is the unique identification of the resource |
| | | |routing. |
+-------------+-------+---------------+-----------------------------------------------------+
@ -898,7 +898,7 @@ attributes of routing entry are listed below.
+-------------+-------+---------------+-----------------------------------------------------+
|Name |In | Type | Description |
+=============+=======+===============+=====================================================+
|id |body | uuid |id is the unique identification of the resource |
|id |body | biginteger |id is the unique identification of the resource |
| | | |routing. |
+-------------+-------+---------------+-----------------------------------------------------+
|top_id |body | string |top_id denotes the resource id on central Neutron. |
@ -953,3 +953,4 @@ from the database.
"resource_type": "router"
}
}

View File

@ -241,7 +241,7 @@ def upgrade(migrate_engine):
cascaded_pods_resource_routing = sql.Table(
'cascaded_pods_resource_routing', meta,
sql.Column('id', sql.Integer, primary_key=True),
sql.Column('id', sql.BigInteger, primary_key=True),
sql.Column('top_id', sql.String(length=127), nullable=False),
sql.Column('bottom_id', sql.String(length=36)),
sql.Column('pod_id', sql.String(length=64), nullable=False),

View File

@ -13,14 +13,14 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_db.sqlalchemy import models
from oslo_utils import timeutils
import sqlalchemy as sql
from sqlalchemy.dialects import mysql
from sqlalchemy.orm import relationship
from sqlalchemy import schema
from oslo_db.sqlalchemy import models
from oslo_utils import timeutils
from tricircle.db import core
@ -442,7 +442,10 @@ class ResourceRouting(core.ModelBase, core.DictBase, models.TimestampMixin):
attributes = ['id', 'top_id', 'bottom_id', 'pod_id', 'project_id',
'resource_type', 'created_at', 'updated_at']
id = sql.Column('id', sql.Integer, primary_key=True)
# sqlite doesn't support auto increment on big integers so we use big int
# for everything but sqlite
id = sql.Column(sql.BigInteger().with_variant(sql.Integer(), 'sqlite'),
primary_key=True, autoincrement=True)
top_id = sql.Column('top_id', sql.String(length=127), nullable=False)
bottom_id = sql.Column('bottom_id', sql.String(length=36))
pod_id = sql.Column('pod_id', sql.String(length=64),