summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamon Li <damonl@vmware.com>2020-01-08 22:58:48 -0800
committerDamon Li <damonl@vmware.com>2020-01-10 07:16:49 +0000
commit60d23fb1e8d4a85ba40162ca8fcc511973f57a09 (patch)
tree567326f2dcf839ab63ab58a9d254b075fd5a6379
parentfa7a6e35e5984d6f2b36e31368fe4634f7a693e2 (diff)
downloadoslo-vmware-60d23fb1e8d4a85ba40162ca8fcc511973f57a09.tar.gz
Pass "store_id" to backend when transfer volume to image2.35.0
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
-rw-r--r--oslo_vmware/image_transfer.py3
-rw-r--r--oslo_vmware/tests/test_image_transfer.py7
2 files changed, 7 insertions, 3 deletions
diff --git a/oslo_vmware/image_transfer.py b/oslo_vmware/image_transfer.py
index 6ff2acb..264fb19 100644
--- a/oslo_vmware/image_transfer.py
+++ b/oslo_vmware/image_transfer.py
@@ -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()
diff --git a/oslo_vmware/tests/test_image_transfer.py b/oslo_vmware/tests/test_image_transfer.py
index 08ac0e7..0bb61b7 100644
--- a/oslo_vmware/tests/test_image_transfer.py
+++ b/oslo_vmware/tests/test_image_transfer.py
@@ -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)