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:
@@ -20,7 +20,9 @@ from nova.objects import base
|
||||
from nova.objects import fields
|
||||
|
||||
|
||||
class Aggregate(base.NovaPersistentObject, base.NovaObject):
|
||||
# TODO(berrange): Remove NovaObjectDictCompat
|
||||
class Aggregate(base.NovaPersistentObject, base.NovaObject,
|
||||
base.NovaObjectDictCompat):
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: String attributes updated to support unicode
|
||||
VERSION = '1.1'
|
||||
@@ -147,7 +149,9 @@ class Aggregate(base.NovaPersistentObject, base.NovaObject):
|
||||
return self.metadata.get('availability_zone', None)
|
||||
|
||||
|
||||
class AggregateList(base.ObjectListBase, base.NovaObject):
|
||||
# TODO(berrange): Remove NovaObjectDictCompat
|
||||
class AggregateList(base.ObjectListBase, base.NovaObject,
|
||||
base.NovaObjectDictCompat):
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: Added key argument to get_by_host()
|
||||
# Aggregate <= version 1.1
|
||||
|
||||
Reference in New Issue
Block a user