Optimize: Replace 'fields.Enum' with 'object'

We don't use any advanced features of 'versionobjects.fields.Enum'
in message fields. We can directly use 'object' there.

Change-Id: I3e2a7f52c8348ff6b1fb82d849a26c650236e78c
This commit is contained in:
TommyLike 2017-07-04 16:34:42 +08:00
parent 22be8149d5
commit 30ac541f8e
1 changed files with 3 additions and 5 deletions

View File

@ -19,17 +19,15 @@ Also, use exception-to-detail mapping to decrease the workload of
classifying event in cinder's task code.
"""
from oslo_versionedobjects import fields
from cinder.i18n import _
class Resource(fields.Enum):
class Resource(object):
VOLUME = 'VOLUME'
class Action(fields.Enum):
class Action(object):
SCHEDULE_ALLOCATE_VOLUME = ('001', _('schedule allocate volume'))
ATTACH_VOLUME = ('002', _('attach volume'))
@ -42,7 +40,7 @@ class Action(fields.Enum):
UPDATE_ATTACHMENT)
class Detail(fields.Enum):
class Detail(object):
UNKNOWN_ERROR = ('001', _('An unknown error occurred.'))
DRIVER_NOT_INITIALIZED = ('002',