4822b45230
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