Merge "Remove DictCompat from instance_info_cache"
This commit is contained in:
commit
9aa9f4578e
@ -25,10 +25,8 @@ from nova.objects import fields
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
# TODO(berrange): Remove NovaObjectDictCompat
|
|
||||||
@base.NovaObjectRegistry.register
|
@base.NovaObjectRegistry.register
|
||||||
class InstanceInfoCache(base.NovaPersistentObject, base.NovaObject,
|
class InstanceInfoCache(base.NovaPersistentObject, base.NovaObject):
|
||||||
base.NovaObjectDictCompat):
|
|
||||||
# Version 1.0: Initial version
|
# Version 1.0: Initial version
|
||||||
# Version 1.1: Converted network_info to store the model.
|
# Version 1.1: Converted network_info to store the model.
|
||||||
# Version 1.2: Added new() and update_cells kwarg to save().
|
# Version 1.2: Added new() and update_cells kwarg to save().
|
||||||
@ -46,7 +44,7 @@ class InstanceInfoCache(base.NovaPersistentObject, base.NovaObject,
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _from_db_object(context, info_cache, db_obj):
|
def _from_db_object(context, info_cache, db_obj):
|
||||||
for field in info_cache.fields:
|
for field in info_cache.fields:
|
||||||
info_cache[field] = db_obj[field]
|
setattr(info_cache, field, db_obj[field])
|
||||||
info_cache.obj_reset_changes()
|
info_cache.obj_reset_changes()
|
||||||
info_cache._context = context
|
info_cache._context = context
|
||||||
return info_cache
|
return info_cache
|
||||||
@ -114,7 +112,8 @@ class InstanceInfoCache(base.NovaPersistentObject, base.NovaObject,
|
|||||||
current._context = None
|
current._context = None
|
||||||
|
|
||||||
for field in self.fields:
|
for field in self.fields:
|
||||||
if self.obj_attr_is_set(field) and self[field] != current[field]:
|
if (self.obj_attr_is_set(field) and
|
||||||
self[field] = current[field]
|
getattr(self, field) != getattr(current, field)):
|
||||||
|
setattr(self, field, getattr(current, field))
|
||||||
|
|
||||||
self.obj_reset_changes()
|
self.obj_reset_changes()
|
||||||
|
@ -469,7 +469,7 @@ def _create_instances_with_cached_ips(orig_func, *args, **kwargs):
|
|||||||
instances, reservation_id = orig_func(*args, **kwargs)
|
instances, reservation_id = orig_func(*args, **kwargs)
|
||||||
fake_cache = _get_fake_cache()
|
fake_cache = _get_fake_cache()
|
||||||
for instance in instances:
|
for instance in instances:
|
||||||
instance['info_cache']['network_info'] = fake_cache
|
instance['info_cache'].network_info = fake_cache
|
||||||
db.instance_info_cache_update(args[1], instance['uuid'],
|
db.instance_info_cache_update(args[1], instance['uuid'],
|
||||||
{'network_info': fake_cache})
|
{'network_info': fake_cache})
|
||||||
return (instances, reservation_id)
|
return (instances, reservation_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user