Add 'volume_attachment' to volume expected attributes
'volume_attachment' is a frequently used attribute when
listing volumes inside or outside cinder, considering
it already has been loaded from database [1], this patch
adds it to volume's expected attributes to improve
performance.
[1]: 0652085f23/cinder/db/sqlalchemy/api.py (L1926)
Change-Id: I3be3c99f9317726fa3182f750b27690da3cdab83
This commit is contained in:
parent
0652085f23
commit
af66bce676
|
@ -597,7 +597,7 @@ class VolumeList(base.ObjectListBase, base.CinderObject):
|
|||
|
||||
@classmethod
|
||||
def _get_expected_attrs(cls, context, *args, **kwargs):
|
||||
expected_attrs = ['metadata', 'volume_type']
|
||||
expected_attrs = ['metadata', 'volume_type', 'volume_attachment']
|
||||
if context.is_admin:
|
||||
expected_attrs.append('admin_metadata')
|
||||
|
||||
|
|
|
@ -62,9 +62,8 @@ class KeyMigrationTestCase(base.BaseVolumeTestCase):
|
|||
if key_id:
|
||||
vol.encryption_key_id = key_id
|
||||
vol.save()
|
||||
self.my_vols = objects.VolumeList.get_all_by_host(self.context,
|
||||
self.conf.host)
|
||||
vol.refresh()
|
||||
self.my_vols.append(vol)
|
||||
return vol
|
||||
|
||||
def create_backup(self, volume_id=fake.VOLUME_ID, key_id=FIXED_KEY_ID):
|
||||
|
|
Loading…
Reference in New Issue