From 30ac541f8e27b8917dc482f0a41d18b8d8299bcd Mon Sep 17 00:00:00 2001 From: TommyLike Date: Tue, 4 Jul 2017 16:34:42 +0800 Subject: [PATCH] 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 --- cinder/message/message_field.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cinder/message/message_field.py b/cinder/message/message_field.py index 8d44fff4bea..457614b7c1f 100644 --- a/cinder/message/message_field.py +++ b/cinder/message/message_field.py @@ -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',