Advertisement
Guest User

Untitled

a guest
Jun 12th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 0.99 KB | None | 0 0
  1. diff --git a/nova/objects/base.py b/nova/objects/base.py
  2. index 315ae30..dd0e72f 100644
  3. --- a/nova/objects/base.py
  4. +++ b/nova/objects/base.py
  5. @@ -95,6 +95,9 @@ class NovaObject(ovoo_base.VersionedObject):
  6.      OBJ_SERIAL_NAMESPACE = 'nova_object'
  7.      OBJ_PROJECT_NAMESPACE = 'nova'
  8.  
  9. +    # Explain
  10. +    obj_field_history = {}
  11. +
  12.      # NOTE(ndipanov): This is nova-specific
  13.      @staticmethod
  14.      def should_migrate_data():
  15. @@ -139,6 +142,13 @@ class NovaObject(ovoo_base.VersionedObject):
  16.          finally:
  17.              self._context = original_context
  18.  
  19. +    def obj_make_compatible(self, primitive, target_version):
  20. +        super(NovaObject, self).obj_make_compatible(primitive, target_version)
  21. +        for field in self.fields:
  22. +            added_in = self.obj_field_history.get(field, '1.0')
  23. +            if target_version < added_in and field in primitive:
  24. +                del primitive[field]
  25. +
  26.  
  27.  class NovaPersistentObject(object):
  28.      """Mixin class for Persistent objects.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement