Pass "store_id" to backend when transfer volume to image

Glance supports multiple stores now. In order to use this feature, on
patch #661676, it added parameter "store_id" when call function
"image_transfer.upload_image". We need to parse this parameter and pass
it to "image_service.update" function.

Closes-Bug: #1857094

Change-Id: I03747f54545ae3f91bf10de76d07de6828a419d6
This commit is contained in:
Damon Li 2020-01-08 22:58:48 -08:00
parent fa7a6e35e5
commit 60d23fb1e8
2 changed files with 7 additions and 3 deletions

View File

@ -338,10 +338,11 @@ def upload_image(context, timeout_secs, image_service, image_id, owner_id,
'owner_id': owner_id}}
updater = loopingcall.FixedIntervalLoopingCall(read_handle.update_progress)
store_id = kwargs.get('store_id')
try:
updater.start(interval=NFC_LEASE_UPDATE_PERIOD)
image_service.update(context, image_id, image_metadata,
data=read_handle)
data=read_handle, store_id=store_id)
finally:
updater.stop()
read_handle.close()

View File

@ -372,6 +372,7 @@ class ImageTransferUtilityTest(base.TestCase):
image_name = 'fake_image'
image_version = 1
store_id = 'fake_store'
fake_VmdkReadHandle = mock.Mock()
fake_rw_handles_VmdkReadHandle.return_value = fake_VmdkReadHandle
@ -389,7 +390,8 @@ class ImageTransferUtilityTest(base.TestCase):
vmdk_size=image_size,
is_public=is_public,
image_name=image_name,
image_version=image_version)
image_version=image_version,
store_id=store_id)
fake_rw_handles_VmdkReadHandle.assert_called_once_with(session,
host,
@ -408,4 +410,5 @@ class ImageTransferUtilityTest(base.TestCase):
image_service.update.assert_called_once_with(context,
image_id,
image_metadata,
data=fake_VmdkReadHandle)
data=fake_VmdkReadHandle,
store_id=store_id)