Change OVOs project_id and user_id to StringField

The DB models define project_id and user_id as Column String fields of
255 characters because historically they weren't wasn't necessarily
UUIDs, but when we created the Versioned Object counterparts of the ORM<
models we forced them to be UUIDs, which will create problems for any
deployment where any of them is not using UUIDs.

We know cases where this is a problem for the project_id, moreover now
that Oslo Versioned Objects library is going to enforce the use of UUIDs
in UUIDFields.

This patch changes those fields to make them of StringField type as they
should have been all along.

This change has no implications on the serialization, so we don't need
to bump versions, we can simply change the hash in the test.

Change-Id: Id94ff7777260cc443f838aa3a8399582b2d00fc2
This commit is contained in:
Gorka Eguileor 2016-05-06 16:33:55 +02:00
parent 42a2eb6940
commit c5c5e24505
6 changed files with 16 additions and 16 deletions

View File

@ -44,8 +44,8 @@ class Backup(base.CinderPersistentObject, base.CinderObject,
fields = {
'id': fields.UUIDField(),
'user_id': fields.UUIDField(),
'project_id': fields.UUIDField(),
'user_id': fields.StringField(),
'project_id': fields.StringField(),
'volume_id': fields.UUIDField(),
'host': fields.StringField(nullable=True),

View File

@ -30,8 +30,8 @@ class CGSnapshot(base.CinderPersistentObject, base.CinderObject,
fields = {
'id': fields.UUIDField(),
'consistencygroup_id': fields.UUIDField(nullable=True),
'project_id': fields.UUIDField(),
'user_id': fields.UUIDField(),
'project_id': fields.StringField(),
'user_id': fields.StringField(),
'name': fields.StringField(nullable=True),
'description': fields.StringField(nullable=True),
'status': fields.StringField(nullable=True),

View File

@ -33,8 +33,8 @@ class ConsistencyGroup(base.CinderPersistentObject, base.CinderObject,
fields = {
'id': fields.UUIDField(),
'user_id': fields.UUIDField(),
'project_id': fields.UUIDField(),
'user_id': fields.StringField(),
'project_id': fields.StringField(),
'host': fields.StringField(nullable=True),
'availability_zone': fields.StringField(nullable=True),
'name': fields.StringField(nullable=True),

View File

@ -40,8 +40,8 @@ class Snapshot(base.CinderPersistentObject, base.CinderObject,
fields = {
'id': fields.UUIDField(),
'user_id': fields.UUIDField(nullable=True),
'project_id': fields.UUIDField(nullable=True),
'user_id': fields.StringField(nullable=True),
'project_id': fields.StringField(nullable=True),
'volume_id': fields.UUIDField(nullable=True),
'cgsnapshot_id': fields.UUIDField(nullable=True),

View File

@ -66,8 +66,8 @@ class Volume(base.CinderPersistentObject, base.CinderObject,
'id': fields.UUIDField(),
'_name_id': fields.UUIDField(nullable=True),
'ec2_id': fields.UUIDField(nullable=True),
'user_id': fields.UUIDField(nullable=True),
'project_id': fields.UUIDField(nullable=True),
'user_id': fields.StringField(nullable=True),
'project_id': fields.StringField(nullable=True),
'snapshot_id': fields.UUIDField(nullable=True),

View File

@ -22,18 +22,18 @@ from cinder import test
# NOTE: The hashes in this list should only be changed if they come with a
# corresponding version bump in the affected objects.
object_data = {
'Backup': '1.4-cae44fe34d5a870110ba93adebc1edca',
'BackupImport': '1.4-cae44fe34d5a870110ba93adebc1edca',
'Backup': '1.4-bcd1797dc2f3e17a46571525e9dbec30',
'BackupImport': '1.4-bcd1797dc2f3e17a46571525e9dbec30',
'BackupList': '1.0-24591dabe26d920ce0756fe64cd5f3aa',
'CGSnapshot': '1.0-78b91e76cb4c56e9cf5c9c41e208c05a',
'CGSnapshot': '1.0-de2586a31264d7647f40c762dece9d58',
'CGSnapshotList': '1.0-e8c3f4078cd0ee23487b34d173eec776',
'ConsistencyGroup': '1.2-bcc1ee6b28840bb089d122ca4fa0cd2c',
'ConsistencyGroup': '1.2-5365b1c670adc3973f0faa54a66af243',
'ConsistencyGroupList': '1.1-73916823b697dfa0c7f02508d87e0f28',
'Service': '1.3-66c8e1683f58546c54551e9ff0a3b111',
'ServiceList': '1.1-cb758b200f0a3a90efabfc5aa2ffb627',
'Snapshot': '1.0-404c1a8b48a808aa0b7cc92cd3ec1e57',
'Snapshot': '1.0-df462bff8b714c8b9127e73aec1145db',
'SnapshotList': '1.0-71661e7180ef6cc51501704a9bea4bf1',
'Volume': '1.3-264388ec57bc4c3353c89f93bebf9482',
'Volume': '1.3-7007592a74a501fa41397f76d4f2a9db',
'VolumeAttachment': '1.0-8fc9a9ac6f554fdf2a194d25dbf28a3b',
'VolumeAttachmentList': '1.0-307d2b6c8dd55ef854f6386898e9e98e',
'VolumeList': '1.1-03ba6cb8c546683e64e15c50042cb1a3',