Merge "Pass "base_image_ref" to backend when transfer volume to image"

This commit is contained in:
Zuul 2020-03-18 14:56:03 +00:00 committed by Gerrit Code Review
commit 7c8be155eb
2 changed files with 13 additions and 7 deletions

View File

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

View File

@ -373,6 +373,7 @@ class ImageTransferUtilityTest(base.TestCase):
image_name = 'fake_image'
image_version = 1
store_id = 'fake_store'
base_image_ref = 'e79161cd-5f9d-4007-8823-81a807a64332'
fake_VmdkReadHandle = mock.Mock()
fake_rw_handles_VmdkReadHandle.return_value = fake_VmdkReadHandle
@ -391,7 +392,8 @@ class ImageTransferUtilityTest(base.TestCase):
is_public=is_public,
image_name=image_name,
image_version=image_version,
store_id=store_id)
store_id=store_id,
base_image_ref=base_image_ref)
fake_rw_handles_VmdkReadHandle.assert_called_once_with(session,
host,
@ -407,8 +409,10 @@ class ImageTransferUtilityTest(base.TestCase):
'vmware_disktype': 'streamOptimized',
'owner_id': owner_id}}
image_service.update.assert_called_once_with(context,
image_id,
image_metadata,
data=fake_VmdkReadHandle,
store_id=store_id)
image_service.update.assert_called_once_with(
context,
image_id,
image_metadata,
data=fake_VmdkReadHandle,
store_id=store_id,
base_image_ref=base_image_ref)