From f97778189242fa7430d0af23523f073a753c3885 Mon Sep 17 00:00:00 2001 From: Rajat Dhasmana Date: Mon, 12 Apr 2021 07:33:43 -0400 Subject: [PATCH] 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] 230bda82c1ada91dcec90b21913d713795164b19 Change-Id: I31c7381f608c7434b092fc443e3c6cf7f41d9c1c --- cinder/objects/service.py | 7 ------- cinder/tests/unit/utils.py | 3 ++- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/cinder/objects/service.py b/cinder/objects/service.py index 15f4a214d08..1686f210b95 100644 --- a/cinder/objects/service.py +++ b/cinder/objects/service.py @@ -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): diff --git a/cinder/tests/unit/utils.py b/cinder/tests/unit/utils.py index f4ed2771ece..9119390c0b2 100644 --- a/cinder/tests/unit/utils.py +++ b/cinder/tests/unit/utils.py @@ -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: