Merge "VMware: Add file open mode to support python3"

This commit is contained in:
Zuul
2018-06-11 23:40:28 +00:00
committed by Gerrit Code Review
2 changed files with 2 additions and 1 deletions

View File

@@ -2572,6 +2572,7 @@ class VMwareVcVmdkDriverTestCase(test.TestCase):
vops.get_entity_name.assert_called_once_with(dc_ref)
cookies = session.vim.client.options.transport.cookiejar
if use_temp_image:
mock_open.assert_called_once_with('/tmp/foo', 'rb')
download_file.assert_called_once_with(
mock.sentinel.read_handle,
self._config.vmware_host_ip,

View File

@@ -868,7 +868,7 @@ class VMwareVcVmdkDriver(driver.VolumeDriver):
tmp_image = tmp_images.get(context, image_id)
if tmp_image:
LOG.debug("Using temporary image.")
with open(tmp_image) as read_handle:
with open(tmp_image, 'rb') as read_handle:
image_transfer.download_file(read_handle,
host_ip,
port,