def test_copy_stream_optimized_disk(self, vmdk_read_handle, start_transfer): read_handle = mock.sentinel.read_handle vmdk_read_handle.return_value = read_handle context = mock.sentinel.context timeout = mock.sentinel.timeout write_handle = mock.Mock(name='/cinder/images/tmpAbcd.vmdk') session = mock.sentinel.session host = mock.sentinel.host port = mock.sentinel.port vm = mock.sentinel.vm vmdk_file_path = mock.sentinel.vmdk_file_path vmdk_size = mock.sentinel.vmdk_size image_transfer.copy_stream_optimized_disk( context, timeout, write_handle, session=session, host=host, port=port, vm=vm, vmdk_file_path=vmdk_file_path, vmdk_size=vmdk_size) vmdk_read_handle.assert_called_once_with(session, host, port, vm, vmdk_file_path, vmdk_size) start_transfer.assert_called_once_with(read_handle, write_handle, timeout)
def test_copy_stream_optimized_disk( self, vmdk_read_handle, start_transfer): read_handle = mock.sentinel.read_handle vmdk_read_handle.return_value = read_handle context = mock.sentinel.context timeout = mock.sentinel.timeout write_handle = mock.Mock(name='/cinder/images/tmpAbcd.vmdk') session = mock.sentinel.session host = mock.sentinel.host port = mock.sentinel.port vm = mock.sentinel.vm vmdk_file_path = mock.sentinel.vmdk_file_path vmdk_size = mock.sentinel.vmdk_size image_transfer.copy_stream_optimized_disk( context, timeout, write_handle, session=session, host=host, port=port, vm=vm, vmdk_file_path=vmdk_file_path, vmdk_size=vmdk_size) vmdk_read_handle.assert_called_once_with( session, host, port, vm, vmdk_file_path, vmdk_size) start_transfer.assert_called_once_with( context, timeout, read_handle, vmdk_size, write_file_handle=write_handle)
def test_copy_stream_optimized_disk( self, loopingcall, vmdk_read_handle, start_transfer): read_handle = mock.Mock() vmdk_read_handle.return_value = read_handle updater = mock.Mock() loopingcall.return_value = updater context = mock.sentinel.context timeout = mock.sentinel.timeout write_handle = mock.Mock(name='/cinder/images/tmpAbcd.vmdk') session = mock.sentinel.session host = mock.sentinel.host port = mock.sentinel.port vm = mock.sentinel.vm vmdk_file_path = mock.sentinel.vmdk_file_path vmdk_size = mock.sentinel.vmdk_size image_transfer.copy_stream_optimized_disk( context, timeout, write_handle, session=session, host=host, port=port, vm=vm, vmdk_file_path=vmdk_file_path, vmdk_size=vmdk_size) vmdk_read_handle.assert_called_once_with( 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, timeout) updater.stop.assert_called_once_with()
def _download_vmdk(self, tmp_file_path, session, backing, vmdk_path, vmdk_size): with open(tmp_file_path, "wb") as tmp_file: image_transfer.copy_stream_optimized_disk(None, self._timeout, tmp_file, session=session, host=self._ip, port=self._port, vm=backing, vmdk_file_path=vmdk_path, vmdk_size=vmdk_size)
def _download_vmdk( self, tmp_file_path, session, backing, vmdk_path, vmdk_size): with open(tmp_file_path, "wb") as tmp_file: image_transfer.copy_stream_optimized_disk( None, self._timeout, tmp_file, session=session, host=self._ip, port=self._port, vm=backing, vmdk_file_path=vmdk_path, vmdk_size=vmdk_size)
def test_copy_stream_optimized_disk(self, loopingcall, vmdk_read_handle, start_transfer): read_handle = mock.Mock() vmdk_read_handle.return_value = read_handle updater = mock.Mock() loopingcall.return_value = updater context = mock.sentinel.context timeout = mock.sentinel.timeout write_handle = mock.Mock(name='/cinder/images/tmpAbcd.vmdk') session = mock.sentinel.session host = mock.sentinel.host port = mock.sentinel.port vm = mock.sentinel.vm vmdk_file_path = mock.sentinel.vmdk_file_path vmdk_size = mock.sentinel.vmdk_size image_transfer.copy_stream_optimized_disk( context, timeout, write_handle, session=session, host=host, port=port, vm=vm, vmdk_file_path=vmdk_file_path, vmdk_size=vmdk_size) vmdk_read_handle.assert_called_once_with(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, timeout) updater.stop.assert_called_once_with()