Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Python Encoding Error when Launching an Instance with Openstack Icehouse

Hi,

I'm following this tutorial for Ubuntu 12.04. Up until the end of Chapter 7, everything goes smoothly. But when I try to launch an instance with:

nova boot --flavor m1.tiny --image cirros-0.3.2-x86_64 --nic net-id=b8c68b13-2991-45d6-86d9-c980cf2cde5b --security-group default --key-name demo-key demo-instance1

I get the following error from "nova show":

fault | {"message": "No valid host was found. ", "code": 500, "created": "2015-01-08T14:04:22Z"}

Looking at the logs, I found this at /var/log/nova/nova-scheduler.log:

2015-01-08 11:04:22.641 5304 ERROR nova.scheduler.filter_scheduler [req-5d2cada7-6f0d-41a4-aa51-7d332019383e 767519f7ae8541c9acce93455824bf8d 935c10c31f374dca8af3eb7368a27aa4] [instance: 5aa873d0-3721-4751-ad50-c71567ec9a87] Error from last host: pargocad-Studio-XPS-8100 (node pargocad-Studio-XPS-8100): [u'Traceback (most recent call last):\n', u' File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 1328, in _build_instance\n set_access_ip=set_access_ip)\n', u' File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 393, in decorated_function\n return function(self, context, args, *kwargs)\n', u' File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 1740, in _spawn\n LOG.exception(_(\'Instance failed to spawn\'), instance=instance)\n', u' File "/usr/lib/python2.7/dist-packages/nova/openstack/common/excutils.py", line 68, in __exit__\n six.reraise(self.type_, self.value, self.tb)\n', u' File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 1737, in _spawn\n block_device_info)\n', u' File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 2288, in spawn\n admin_pass=admin_password)\n', u' File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 2657, in _create_image\n project_id=instance[\'project_id\'])\n', u' File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/imagebackend.py", line 192, in cache\n args, *kwargs)\n', u' File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/imagebackend.py", line 413, in create_image\n copy_qcow2_image(base, self.path, size)\n', u' File "/usr/lib/python2.7/dist-packages/nova/openstack/common/lockutils.py", line 249, in inner\n return f(args, *kwargs)\n', u' File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/imagebackend.py", line 379, in copy_qcow2_image\n disk.extend(target, size, use_cow=True)\n', u' File "/usr/lib/python2.7/dist-packages/nova/virt/disk/api.py", line 155, in extend\n if not is_image_partitionless(image, use_cow):\n', u' File "/usr/lib/python2.7/dist-packages/nova/virt/disk/api.py", line 205, in is_image_partitionless\n fs.setup()\n', u' File "/usr/lib/python2.7/dist-packages/nova/virt/disk/vfs/localfs.py", line 81, in setup\n self.teardown()\n', u' File "/usr/lib/python2.7/dist-packages/nova/openstack/common/excutils.py", line 68, in __exit__\n six.reraise(self.type_, self.value, self.tb)\n', u' File "/usr/lib/python2.7/dist-packages/nova/virt/disk/vfs/localfs.py", line 75, in setup\n if not mount.do_mount():\n', u' File "/usr/lib/python2.7/dist-packages/nova/virt/disk/mount/api.py", line 218, in do_mount\n status = self.get_dev() and self.map_dev() and self.mnt_dev()\n', u' File "/usr/lib/python2.7/dist-packages/nova/virt/disk/mount/api.py", line 193, in mnt_dev\n discard_warnings=True, run_as_root=True)\n', u' File "/usr/lib/python2.7/dist-packages/nova/utils.py", line 172, in trycmd\n return processutils.trycmd(args, *kwargs)\n', u' File "/usr/lib/python2.7/dist-packages/nova/openstack/common/processutils.py", line 225, in trycmd\n out, err = execute(args, *kwargs)\n', u' File "/usr/lib/python2.7/dist-packages/nova/openstack/common/processutils.py", line 191, in execute\n sanitized_stderr = strutils.mask_password(stderr)\n', u' File "/usr/lib/python2.7/dist-packages/nova/openstack/common/strutils.py", line 274, in mask_password\n message = six.text_type(message)\n', u"UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 10: ordinal not in range(128)\n"]

I think the most important information is this:

File "/usr/lib/python2.7/dist-packages/nova/openstack/common/strutils.py", line 274, in mask_password\n message = six.text_type(message)\n', u"UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 10: ordinal not in range(128)\n"]

This seems to be a problem with Python encoding. I found these two questions related:

https://ask.openstack.org/en/question/55470/ascii-codec-cant-decode-byte-0xc3-in-position-30-ordinal-not-in-range128-error-when-launching-an-instance-in-rdo-juno/

https://ask.openstack.org/en/question/46916/every-nova-command-i-receive-this-ascii-codec-cant-decode-byte-0xe2-in-position-0-ordinal-not-in-range128/

Both mention that the problem is related to no printable characters on the database or in the rc files. From my MySql I got this:

mysql> select * from endpoint; +----------------------------------+----------------------------------+-----------+-----------+----------------------------------+-----------------------------------------+-------+---------+ | id | legacy_endpoint_id | interface | region | service_id | url | extra | enabled | +----------------------------------+----------------------------------+-----------+-----------+----------------------------------+-----------------------------------------+-------+---------+ | 0c8fd43802f34522860d47f7c4d77fe3 | 71f8794b20554142a60c1c3729942b13 | internal | regionOne | 6ff0190b23a042d0a3be40dbdcdf2a5b | http://controller:9292 | {} | 1 | | 5fa85e978b8b48ee87988ae9085213a4 | d99d5319f11b483d8e7281afe2386e51 | public | regionOne | 46dc24d6a0024a54832a961c1c7ad8c0 | http://controller:9696 | {} | 1 | | 6255ad184417429c8ac606bd08a6a412 | 71f8794b20554142a60c1c3729942b13 | admin | regionOne | 6ff0190b23a042d0a3be40dbdcdf2a5b | http://controller:9292 | {} | 1 | | 637d50b8749f47edaec7985552bee4bb | d99d5319f11b483d8e7281afe2386e51 | admin | regionOne | 46dc24d6a0024a54832a961c1c7ad8c0 | http://controller:9696 | {} | 1 | | 71d4ab28950e41e9b851dd0d7bd92fd9 | 71f8794b20554142a60c1c3729942b13 | public | regionOne | 6ff0190b23a042d0a3be40dbdcdf2a5b | http://controller:9292 | {} | 1 | | 7a8f01f21666452680629fee67b04ca5 | 27e5cc7afc5c485095c0541e3c417cde | admin | regionOne | 70cf223210224a0790cfc22f3164231f | http://controller:8774/v2/%(tenant_id)s | {} | 1 | | 8f11efe0099246779c7e348a6ec761d4 | 7e656e8ba7fb4c4b8aa4d36710efe004 | internal | regionOne | 9e8b5c46ca4a43629ecc4b651c95d0b6 | http://controller:5000/v2.0 | {} | 1 | | 92dedfa7eef540bcb80db289c54ae8bb | 27e5cc7afc5c485095c0541e3c417cde | internal | regionOne | 70cf223210224a0790cfc22f3164231f | http://controller:8774/v2/%(tenant_id)s | {} | 1 | | ad7ad3bd6e9243aba6c7286c5d6819ba | 7e656e8ba7fb4c4b8aa4d36710efe004 | admin | regionOne | 9e8b5c46ca4a43629ecc4b651c95d0b6 | http://controller:35357/v2.0 | {} | 1 | | c9846d5458a641129db36ba35c8c3b83 | 27e5cc7afc5c485095c0541e3c417cde | public | regionOne | 70cf223210224a0790cfc22f3164231f | http://controller:8774/v2/%(tenant_id)s | {} | 1 | | c9edb31ce7a54fa6a4ae4c3d2c828a88 | d99d5319f11b483d8e7281afe2386e51 | internal | regionOne | 46dc24d6a0024a54832a961c1c7ad8c0 | http://controller:9696 | {} | 1 | | f4da34ec5a294576b7d34a68e0db0133 | 7e656e8ba7fb4c4b8aa4d36710efe004 | public | regionOne | 9e8b5c46ca4a43629ecc4b651c95d0b6 | http://controller:5000/v2.0 | {} | 1 | +----------------------------------+----------------------------------+-----------+-----------+----------------------------------+-----------------------------------------+-------+---------+ 12 rows in set (0.00 sec)

mysql> select * from service; +----------------------------------+----------+--------------------------------------------------------------+---------+ | id | type | extra | enabled | +----------------------------------+----------+--------------------------------------------------------------+---------+ | 46dc24d6a0024a54832a961c1c7ad8c0 | network | {"name": "neutron", "description": "OpenStack Networking"} | 1 | | 6ff0190b23a042d0a3be40dbdcdf2a5b | image | {"name": "glance", "description": "OpenStack Image Service"} | 1 | | 70cf223210224a0790cfc22f3164231f | compute | {"name": "nova", "description": "OpenStack Compute"} | 1 | | 9e8b5c46ca4a43629ecc4b651c95d0b6 | identity | {"name": "keystone", "description": "OpenStack Identity"} | 1 | +----------------------------------+----------+--------------------------------------------------------------+---------+ 4 rows in set (0.00 sec)

And my demo-openrc.sh is just like this:

export OS_USERNAME=demo export OS_PASSWORD=demopass export OS_TENANT_NAME=demo export OS_AUTH_URL=http://controller:35357/v2.0

Everything seems OK, printable in UTF-8. I also checked the .conf files for each service. They are all OK. I'm using Ubuntu 12.04.5 LTS with Python 2.7.3.

Any tips?