When transferring db volume module through RPC call, it becomes
dict objects during RPC call. The attributes/properties
of the type can't be used.
As a result, to get volume['name'] raises KeyError.
The issue is fixed by retrieving volume from db.
Using volume version object will fix everything but it is
too late in Liberty. To keep code consistency, db.get_volume
is used in the fix.
Change-Id: I5ac7f083d5b4b7490347069728eb4b938c20885c
Closes-bug:
1491210
volume = tests_utils.create_volume(self.context, size=1,
status='available',
host=fake_host)
- new_volume = tests_utils.create_volume(self.context, size=1,
- status='available',
- host=fake_new_host)
- new_volume['_name_id'] = 'fake_name_id'
- new_volume['provider_location'] = 'fake_provider_location'
+ new_volume = tests_utils.create_volume(
+ self.context, size=1,
+ status='available',
+ provider_location='fake_provider_location',
+ _name_id='fake_name_id',
+ host=fake_new_host)
fake_update_error = {'_name_id': new_volume['_name_id'],
'provider_location':
new_volume['provider_location']}
volume_status):
"""Finalize migration process on backend device."""
model_update = None
+ # This is temporary fix for bug 1491210.
+ volume = self.db.volume_get(ctxt, volume['id'])
+ new_volume = self.db.volume_get(ctxt, new_volume['id'])
try:
model_update = self.driver.update_migrated_volume(ctxt,
volume,