Attempting to use a gzip for user_data on Nova boot fails:
nova --debug boot --flavor m1.small --image myImage --nic net-id=025e776e-9e25-461c-a312-e88a56fa7832,v4-fixed-ip=10.10.10.5 --user-data /mygzip.gz
DEBUG (shell:803) 'utf8' codec can't decode byte 0x8b in position 1: invalid start byte
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/novaclient/shell.py", line 800, in main
OpenStackComputeShell().main(argv)
File "/usr/lib/python2.6/site-packages/novaclient/shell.py", line 730, in main
args.func(self.cs, args)
File "/usr/lib/python2.6/site-packages/novaclient/v1_1/shell.py", line 470, in do_boot
server = cs.servers.create(*boot_args, **boot_kwargs)
File "/usr/lib/python2.6/site-packages/novaclient/v1_1/servers.py", line 902, in create
**boot_kwargs)
File "/usr/lib/python2.6/site-packages/novaclient/v1_1/servers.py", line 465, in _boot
userdata = encodeutils.safe_encode(userdata)
File "/usr/lib/python2.6/site-packages/oslo/utils/encodeutils.py", line 86, in safe_encode
text = safe_decode(text, incoming, errors)
File "/usr/lib/python2.6/site-packages/oslo/utils/encodeutils.py", line 57, in safe_decode
return text.decode('utf-8', errors)
File "/usr/lib64/python2.6/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x8b in position 1: invalid start byte
ERROR (UnicodeDecodeError): 'utf8' codec can't decode byte 0x8b in position 1: invalid start byte
If I base64 encode the gzip and pass it on a REST API call using curl the deploy/create server runs properly. The value is correctly written to the instance's table, and the gzip is correctly placed in the config drive without data loss due to improper encode/decoding. So it appears that this should work once the encoding issue with novaclient is fixed.
Note that cloud-init supports gzipped userdata so that users can gzip their MIME or script files to keep user_data under the 65K DB column limit.
Fix proposed to branch: master /review. openstack. org/170399
Review: https:/