Remove uuid check/generate in service

The code to check for uuid and generate if there isn't one while
getting the service was added for an online migration which was
removed with commit[1].
Since all service entries in database have UUIDs, this code isn't
useful and can be removed.

[1] 230bda82c1

Change-Id: I31c7381f608c7434b092fc443e3c6cf7f41d9c1c
This commit is contained in:
Rajat Dhasmana 2021-04-12 07:33:43 -04:00
parent 355681cd53
commit f977781892
2 changed files with 2 additions and 8 deletions

View File

@ -112,13 +112,6 @@ class Service(base.CinderPersistentObject, base.CinderObject,
service.obj_reset_changes()
# TODO(jdg): Remove in S when we're sure all Services have UUID in db
if 'uuid' not in service:
service.uuid = uuidutils.generate_uuid()
LOG.debug('Generated UUID %(uuid)s for service %(id)i',
dict(uuid=service.uuid, id=service.id))
service.save()
return service
def obj_load_attr(self, attrname):

View File

@ -489,7 +489,8 @@ def create_service(ctxt, values=None):
values = values or {}
v = default_service_values()
v.update(values)
service = db.service_create(ctxt, v)
service = objects.Service(ctxt, **v)
service.create()
# We need to read the contents from the DB if we have set updated_at
# or created_at fields
if 'updated_at' in values or 'created_at' in values: