Use to_dict() instead for cinder resources
After the bug #1479641 fixed and we bumped up requirements for latest release which provides to_dict() for resources, this patch removes _show_resources() method for cinder resources. Change-Id: I09b7009bd663b98dead0cf0634a3413f9df7c9f7
This commit is contained in:
parent
a2d829f312
commit
fa67f34791
@ -110,11 +110,6 @@ class CinderEncryptedVolumeType(resource.Resource):
|
||||
volume_type=self.resource_id, specs=prop_diff
|
||||
)
|
||||
|
||||
# TODO(prazumovsky): remove this method when bug #1479641 is fixed.
|
||||
def _show_resource(self):
|
||||
evt = self.client().volume_encryption_types.get(self.resource_id)
|
||||
return evt._info
|
||||
|
||||
|
||||
def resource_mapping():
|
||||
return {
|
||||
|
@ -289,11 +289,6 @@ class CinderVolume(vb.BaseVolume, sh.SchedulerHintsMixin):
|
||||
return vol.description
|
||||
return six.text_type(getattr(vol, name))
|
||||
|
||||
# TODO(huangtianhua): remove this method when bug #1479641 is fixed.
|
||||
def _show_resource(self):
|
||||
volume = self.client().volumes.get(self.resource_id)
|
||||
return volume._info
|
||||
|
||||
def check_create_complete(self, vol_id):
|
||||
complete = super(CinderVolume, self).check_create_complete(vol_id)
|
||||
# Cinder just supports update read only for volume in available,
|
||||
|
@ -139,11 +139,6 @@ class CinderVolumeType(resource.Resource):
|
||||
# add the new projects access
|
||||
self._add_projects_access(set(new_projects) - set(old_projects))
|
||||
|
||||
# TODO(huangtianhua): remove this method when bug #1479641 is fixed.
|
||||
def _show_resource(self):
|
||||
vtype = self.client().volume_types.get(self.resource_id)
|
||||
return vtype._info
|
||||
|
||||
def validate(self):
|
||||
super(CinderVolumeType, self).validate()
|
||||
|
||||
|
@ -197,7 +197,7 @@ class CinderVolumeTypeTest(common.HeatTestCase):
|
||||
volume_type_id = '927202df-1afb-497f-8368-9c2d2f26e5db'
|
||||
self.my_volume_type.resource_id = volume_type_id
|
||||
volume_type = mock.Mock()
|
||||
volume_type._info = {'vtype': 'info'}
|
||||
volume_type.to_dict = lambda: {'vtype': 'info'}
|
||||
self.volume_types.get.return_value = volume_type
|
||||
self.assertEqual({'vtype': 'info'},
|
||||
self.my_volume_type.FnGetAtt('show'))
|
||||
|
@ -98,7 +98,7 @@ class CinderEncryptedVolumeTypeTest(common.HeatTestCase):
|
||||
volume_type_id = '01bd581d-33fe-4d6d-bd7b-70ae076d39fb'
|
||||
self.my_encrypted_vol_type.resource_id = volume_type_id
|
||||
volume_type = mock.Mock()
|
||||
volume_type._info = {'vtype': 'info'}
|
||||
volume_type.to_dict = lambda: {'vtype': 'info'}
|
||||
self.volume_encryption_types.get.return_value = volume_type
|
||||
self.assertEqual({'vtype': 'info'},
|
||||
self.my_encrypted_vol_type.FnGetAtt('show'))
|
||||
|
@ -99,7 +99,7 @@ class FakeVolume(object):
|
||||
|
||||
def __init__(self, status, **attrs):
|
||||
self.status = status
|
||||
self._info = {'volume': 'info'}
|
||||
self.to_dict = lambda: {'volume': 'info'}
|
||||
for key, value in six.iteritems(attrs):
|
||||
setattr(self, key, value)
|
||||
if 'id' not in attrs:
|
||||
|
Loading…
Reference in New Issue
Block a user