Reviewed: https://review.openstack.org/642235 Committed: https://git.openstack.org/cgit/openstack/rally-openstack/commit/?id=4822b452304c53d3102e75d4d2924fb7ec1a93ae Submitter: Zuul Branch: master
commit 4822b452304c53d3102e75d4d2924fb7ec1a93ae Author: Dmitrii Shcherbakov <email address hidden> Date: Sat Mar 9 02:51:18 2019 +0300
py3: use binary mode for opening image files
If binary mode is not used when running with python3 glance image uploads fail as files are opened with encoding='UTF-8' by default.
It results in the following confusing error message:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfb in position 3: invalid start byte
(Pdb) e UnicodeDecodeError('utf-8', b'QFI\xfb\x00\x00\
0xfb is a QCOW magic string and is invalid from UTF-8 standard perspective. From the QCOW2 spec:
Byte 0 - 3: magic QCOW magic string ("QFI\xfb")
Tracing have shown that the error comes from python-glanceclient when a file handle passed to it is attempted to be used for sending image chunks.
Change-Id: I6bb31fe1d3f79a8fd4707a5576204dee69a3f307 Depends-On: I4991acccefd4754e209feafd5e24d03c76c283f8 Closes-Bug: #1819274
Reviewed: https:/ /review. openstack. org/642235 /git.openstack. org/cgit/ openstack/ rally-openstack /commit/ ?id=4822b452304 c53d3102e75d4d2 924fb7ec1a93ae
Committed: https:/
Submitter: Zuul
Branch: master
commit 4822b452304c53d 3102e75d4d2924f b7ec1a93ae
Author: Dmitrii Shcherbakov <email address hidden>
Date: Sat Mar 9 02:51:18 2019 +0300
py3: use binary mode for opening image files
If binary mode is not used when running with python3 glance image
uploads fail as files are opened with encoding='UTF-8' by default.
It results in the following confusing error message:
UnicodeDeco deError: 'utf-8' codec can't decode byte 0xfb in position 3:
invalid start byte
(Pdb) e deError( 'utf-8' , b'QFI\xfb\x00\x00\
UnicodeDeco
0xfb is a QCOW magic string and is invalid from UTF-8 standard
perspective. From the QCOW2 spec:
Byte 0 - 3: magic
QCOW magic string ("QFI\xfb")
Tracing have shown that the error comes from python-glanceclient when a
file handle passed to it is attempted to be used for sending image
chunks.
Change-Id: I6bb31fe1d3f79a 8fd4707a5576204 dee69a3f307 4e209feafd5e24d 03c76c283f8
Depends-On: I4991acccefd475
Closes-Bug: #1819274