From fd5e2aadc341f5edec788193b5899cf1b68fd511 Mon Sep 17 00:00:00 2001 From: Xinli Guan Date: Wed, 28 Sep 2016 03:58:08 +0000 Subject: [PATCH] Moving the OPTIONAL_FIELDS inside the OVO object group In working patch 251989, Michal Dulko points out that all the OVOs should have OPTIONAL_FIELDS inside object. This patch will fix the issue in OVO, group. Change-Id: Icdedf273333abefa5ce6daf81e7a94e0308c1a18 --- cinder/objects/group.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cinder/objects/group.py b/cinder/objects/group.py index 68244080e76..a7d0e6c15d7 100644 --- a/cinder/objects/group.py +++ b/cinder/objects/group.py @@ -20,8 +20,6 @@ from cinder.objects import base from cinder.objects import fields as c_fields from oslo_versionedobjects import fields -OPTIONAL_FIELDS = ['volumes', 'volume_types', 'group_snapshots'] - @base.CinderObjectRegistry.register class Group(base.CinderPersistentObject, base.CinderObject, @@ -31,6 +29,8 @@ class Group(base.CinderPersistentObject, base.CinderObject, # source_group_id VERSION = '1.1' + OPTIONAL_FIELDS = ['volumes', 'volume_types', 'group_snapshots'] + fields = { 'id': fields.UUIDField(), 'user_id': fields.StringField(), @@ -58,7 +58,7 @@ class Group(base.CinderPersistentObject, base.CinderObject, if expected_attrs is None: expected_attrs = [] for name, field in group.fields.items(): - if name in OPTIONAL_FIELDS: + if name in Group.OPTIONAL_FIELDS: continue value = db_group.get(name) setattr(group, name, value) @@ -115,7 +115,7 @@ class Group(base.CinderPersistentObject, base.CinderObject, self._from_db_object(self._context, self, db_groups) def obj_load_attr(self, attrname): - if attrname not in OPTIONAL_FIELDS: + if attrname not in Group.OPTIONAL_FIELDS: raise exception.ObjectActionError( action='obj_load_attr', reason=_('attribute %s not lazy-loadable') % attrname)