Correct default type name reference

Inside cinder, default types are returned as dictionary but the
API call return it as a object.
Correcting name reference for the same from dictionary (['name'])
to object (.name)

Change-Id: Iaf7f1174f80624a0e1f47bea3c0c0b36d2345557
This commit is contained in:
whoami-rajat 2020-08-25 16:27:15 +00:00
parent 78217017e2
commit 3c44d6851d
2 changed files with 3 additions and 3 deletions

View File

@ -456,8 +456,8 @@ class Store(glance_store.driver.Store):
if cinder_volume_type and volume.volume_type == cinder_volume_type:
return True
elif not cinder_volume_type:
default_type = cinder_client.volume_types.default()['name']
if volume.volume_type == default_type:
default_type = cinder_client.volume_types.default()
if volume.volume_type == default_type.name:
return True
except Exception:
# Glance calls this method to update legacy images URL

View File

@ -299,7 +299,7 @@ class TestMultiCinderStore(base.MultiStoreBaseTest,
mocked_cc.return_value = FakeObject(volumes=FakeObject(
get=lambda volume_id: FakeObject(volume_type='some_type')),
volume_types=FakeObject(
default=lambda: {'name': 'some_type'}))
default=lambda: FakeObject(name='some_type')))
# When cinder_volume_type is set and is same as volume's type
self.config(cinder_volume_type='some_type',
group=self.store.backend_group)