]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Merge "Use version convert methods from oslo.utils"
authorJenkins <jenkins@review.openstack.org>
Fri, 11 Sep 2015 17:12:56 +0000 (17:12 +0000)
committerGerrit Code Review <review@openstack.org>
Fri, 11 Sep 2015 17:12:56 +0000 (17:12 +0000)
1  2 
cinder/objects/backup.py
cinder/objects/snapshot.py
cinder/objects/volume.py
cinder/utils.py

Simple merge
Simple merge
index c2ece420381c07052541d17741c475114ae98be4,46c3d8d8f3f5dfe8853664fdd775f9e129d2d2e2..69435c308ad9c5bd1b7584b16fa59134d4d251b9
@@@ -21,11 -22,9 +22,10 @@@ from cinder import exceptio
  from cinder.i18n import _
  from cinder import objects
  from cinder.objects import base
- from cinder import utils
  
  CONF = cfg.CONF
 -OPTIONAL_FIELDS = []
 +OPTIONAL_FIELDS = ['metadata', 'admin_metadata',
 +                   'volume_type', 'volume_attachment']
  LOG = logging.getLogger(__name__)
  
  
@@@ -137,16 -97,12 +137,16 @@@ class Volume(base.CinderPersistentObjec
      def obj_make_compatible(self, primitive, target_version):
          """Make an object representation compatible with a target version."""
          super(Volume, self).obj_make_compatible(primitive, target_version)
-         target_version = utils.convert_version_to_tuple(target_version)
+         target_version = versionutils.convert_version_to_tuple(target_version)
  
      @staticmethod
 -    def _from_db_object(context, volume, db_volume):
 +    def _from_db_object(context, volume, db_volume, expected_attrs=None):
 +        if expected_attrs is None:
 +            expected_attrs = []
          for name, field in volume.fields.items():
 -            value = db_volume[name]
 +            if name in OPTIONAL_FIELDS:
 +                continue
 +            value = db_volume.get(name)
              if isinstance(field, fields.IntegerField):
                  value = value or 0
              volume[name] = value
diff --cc cinder/utils.py
Simple merge