Update NFC lease progress
Adding a looping call to periodically update NFC lease progress during virtual disk copy from ESXi to file handle. Change-Id: Id562d200c92af94151b08d3ae4217da41edea55e
This commit is contained in:
parent
95d849ebe7
commit
ae6c2ae1d2
@ -286,7 +286,13 @@ def copy_stream_optimized_disk(
|
|||||||
kwargs.get('vm'),
|
kwargs.get('vm'),
|
||||||
kwargs.get('vmdk_file_path'),
|
kwargs.get('vmdk_file_path'),
|
||||||
file_size)
|
file_size)
|
||||||
_start_transfer(read_handle, write_handle, timeout_secs)
|
|
||||||
|
updater = loopingcall.FixedIntervalLoopingCall(read_handle.update_progress)
|
||||||
|
try:
|
||||||
|
updater.start(interval=NFC_LEASE_UPDATE_PERIOD)
|
||||||
|
_start_transfer(read_handle, write_handle, timeout_secs)
|
||||||
|
finally:
|
||||||
|
updater.stop()
|
||||||
LOG.debug("Downloaded virtual disk: %s.", vmdk_file_path)
|
LOG.debug("Downloaded virtual disk: %s.", vmdk_file_path)
|
||||||
|
|
||||||
|
|
||||||
|
@ -315,12 +315,16 @@ class ImageTransferUtilityTest(base.TestCase):
|
|||||||
|
|
||||||
@mock.patch.object(image_transfer, '_start_transfer')
|
@mock.patch.object(image_transfer, '_start_transfer')
|
||||||
@mock.patch('oslo_vmware.rw_handles.VmdkReadHandle')
|
@mock.patch('oslo_vmware.rw_handles.VmdkReadHandle')
|
||||||
|
@mock.patch('oslo_vmware.common.loopingcall.FixedIntervalLoopingCall')
|
||||||
def test_copy_stream_optimized_disk(
|
def test_copy_stream_optimized_disk(
|
||||||
self, vmdk_read_handle, start_transfer):
|
self, loopingcall, vmdk_read_handle, start_transfer):
|
||||||
|
|
||||||
read_handle = mock.sentinel.read_handle
|
read_handle = mock.Mock()
|
||||||
vmdk_read_handle.return_value = read_handle
|
vmdk_read_handle.return_value = read_handle
|
||||||
|
|
||||||
|
updater = mock.Mock()
|
||||||
|
loopingcall.return_value = updater
|
||||||
|
|
||||||
context = mock.sentinel.context
|
context = mock.sentinel.context
|
||||||
timeout = mock.sentinel.timeout
|
timeout = mock.sentinel.timeout
|
||||||
write_handle = mock.Mock(name='/cinder/images/tmpAbcd.vmdk')
|
write_handle = mock.Mock(name='/cinder/images/tmpAbcd.vmdk')
|
||||||
@ -338,8 +342,12 @@ class ImageTransferUtilityTest(base.TestCase):
|
|||||||
|
|
||||||
vmdk_read_handle.assert_called_once_with(
|
vmdk_read_handle.assert_called_once_with(
|
||||||
session, host, port, vm, vmdk_file_path, vmdk_size)
|
session, host, port, vm, vmdk_file_path, vmdk_size)
|
||||||
|
loopingcall.assert_called_once_with(read_handle.update_progress)
|
||||||
|
updater.start.assert_called_once_with(
|
||||||
|
interval=image_transfer.NFC_LEASE_UPDATE_PERIOD)
|
||||||
start_transfer.assert_called_once_with(read_handle, write_handle,
|
start_transfer.assert_called_once_with(read_handle, write_handle,
|
||||||
timeout)
|
timeout)
|
||||||
|
updater.stop.assert_called_once_with()
|
||||||
|
|
||||||
@mock.patch('oslo_vmware.rw_handles.VmdkReadHandle')
|
@mock.patch('oslo_vmware.rw_handles.VmdkReadHandle')
|
||||||
@mock.patch.object(image_transfer, '_start_transfer')
|
@mock.patch.object(image_transfer, '_start_transfer')
|
||||||
|
Loading…
Reference in New Issue
Block a user