Merge "To fix miscellaneous bugs in OVOs"
This commit is contained in:
commit
f6ab36d9d1
@ -41,7 +41,7 @@ class ViewBuilder(common.ViewBuilder):
|
|||||||
'id': qos_spec.id,
|
'id': qos_spec.id,
|
||||||
'name': qos_spec.name,
|
'name': qos_spec.name,
|
||||||
'consumer': qos_spec.consumer,
|
'consumer': qos_spec.consumer,
|
||||||
'specs': qos_spec.specs
|
'specs': qos_spec.specs,
|
||||||
},
|
},
|
||||||
'links': self._get_links(request,
|
'links': self._get_links(request,
|
||||||
qos_spec.id),
|
qos_spec.id),
|
||||||
|
@ -100,7 +100,7 @@ class QualityOfServiceSpecs(base.CinderPersistentObject,
|
|||||||
return changes
|
return changes
|
||||||
|
|
||||||
def obj_load_attr(self, attrname):
|
def obj_load_attr(self, attrname):
|
||||||
if attrname not in QualityOfServiceSpecs.OPTIONAL_FIELDS:
|
if attrname not in self.OPTIONAL_FIELDS:
|
||||||
raise exception.ObjectActionError(
|
raise exception.ObjectActionError(
|
||||||
action='obj_load_attr',
|
action='obj_load_attr',
|
||||||
reason=_('attribute %s not lazy-loadable') % attrname)
|
reason=_('attribute %s not lazy-loadable') % attrname)
|
||||||
@ -112,13 +112,14 @@ class QualityOfServiceSpecs(base.CinderPersistentObject,
|
|||||||
self.volume_types = objects.VolumeTypeList.get_all_types_for_qos(
|
self.volume_types = objects.VolumeTypeList.get_all_types_for_qos(
|
||||||
self._context, self.id)
|
self._context, self.id)
|
||||||
|
|
||||||
@staticmethod
|
@classmethod
|
||||||
def _from_db_object(context, qos_spec, db_qos_spec, expected_attrs=None):
|
def _from_db_object(cls, context, qos_spec, db_qos_spec,
|
||||||
|
expected_attrs=None):
|
||||||
if expected_attrs is None:
|
if expected_attrs is None:
|
||||||
expected_attrs = []
|
expected_attrs = []
|
||||||
|
|
||||||
for name, field in qos_spec.fields.items():
|
for name, field in qos_spec.fields.items():
|
||||||
if name not in QualityOfServiceSpecs.OPTIONAL_FIELDS:
|
if name not in cls.OPTIONAL_FIELDS:
|
||||||
value = db_qos_spec.get(name)
|
value = db_qos_spec.get(name)
|
||||||
# 'specs' could be null if only a consumer is given, so make
|
# 'specs' could be null if only a consumer is given, so make
|
||||||
# it an empty dict instead of None
|
# it an empty dict instead of None
|
||||||
|
@ -114,12 +114,13 @@ class Snapshot(base.CinderPersistentObject, base.CinderObject,
|
|||||||
super(Snapshot, self).obj_make_compatible(primitive, target_version)
|
super(Snapshot, self).obj_make_compatible(primitive, target_version)
|
||||||
target_version = versionutils.convert_version_to_tuple(target_version)
|
target_version = versionutils.convert_version_to_tuple(target_version)
|
||||||
|
|
||||||
@staticmethod
|
@classmethod
|
||||||
def _from_db_object(context, snapshot, db_snapshot, expected_attrs=None):
|
def _from_db_object(cls, context, snapshot, db_snapshot,
|
||||||
|
expected_attrs=None):
|
||||||
if expected_attrs is None:
|
if expected_attrs is None:
|
||||||
expected_attrs = []
|
expected_attrs = []
|
||||||
for name, field in snapshot.fields.items():
|
for name, field in snapshot.fields.items():
|
||||||
if name in Snapshot.OPTIONAL_FIELDS:
|
if name in cls.OPTIONAL_FIELDS:
|
||||||
continue
|
continue
|
||||||
value = db_snapshot.get(name)
|
value = db_snapshot.get(name)
|
||||||
if isinstance(field, fields.IntegerField):
|
if isinstance(field, fields.IntegerField):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user