objects: allow creation of objects without dict item compat
The dict compat support in NovaObject is useful for incrementally converting existing code over to use objects. Any brand new objects though have no reason to support dictionary access, so there should be a way to disable this compat mode. This moves all the dict compat support methods out of NovaObject, to a new class NovaObjectDictCompat. All existing objects are updated to add this new class as a mix-in parent. In future any completely new objects (ie ones which aren't being used to converted existing code from dict instances) should avoid inheriting from NovaObjectDictCompat. Existing objects should also have this parent class removed once all callers are audited and/or updated to ensure they do not require dict compat. Change-Id: I03f93f0c40df6f5f7df9cefe28dff900c22294c9
This commit is contained in:
@@ -28,7 +28,9 @@ from nova.openstack.common import log as logging
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class InstanceFault(base.NovaPersistentObject, base.NovaObject):
|
||||
# TODO(berrange): Remove NovaObjectDictCompat
|
||||
class InstanceFault(base.NovaPersistentObject, base.NovaObject,
|
||||
base.NovaObjectDictCompat):
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: String attributes updated to support unicode
|
||||
# Version 1.2: Added create()
|
||||
@@ -87,7 +89,9 @@ class InstanceFault(base.NovaPersistentObject, base.NovaObject):
|
||||
LOG.exception(_LE("Failed to notify cells of instance fault"))
|
||||
|
||||
|
||||
class InstanceFaultList(base.ObjectListBase, base.NovaObject):
|
||||
# TODO(berrange): Remove NovaObjectDictCompat
|
||||
class InstanceFaultList(base.ObjectListBase, base.NovaObject,
|
||||
base.NovaObjectDictCompat):
|
||||
# Version 1.0: Initial version
|
||||
# InstanceFault <= version 1.1
|
||||
# Version 1.1: InstanceFault version 1.2
|
||||
|
||||
Reference in New Issue
Block a user