Creating a VM with a non-ASCII name fails with an Unicode error in libvirt guest create()

Bug #1730756 reported by Victor Stinner
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Matt Riedemann

Bug Description

Creating a VM with a non-ASCII name in nova with the libvirt driver fails with an UnicodeEncodeError error.

Instance failed to spawn: UnicodeEncodeError: 'ascii' codec can't encode character u'\u266b' in position 294: ord
Traceback (most recent call last):
  File "/opt/stack/nova/nova/compute/manager.py", line 2208, in _build_resources
    yield resources
  File "/opt/stack/nova/nova/compute/manager.py", line 2001, in _build_and_run_instance
    block_device_info=block_device_info)
  File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 2821, in spawn
    destroy_disks_on_failure=True)
  File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 5289, in _create_domain_and_network
    destroy_disks_on_failure)
  File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
    self.force_reraise()
  File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
    six.reraise(self.type_, self.value, self.tb)
  File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 5259, in _create_domain_and_network
    post_xml_callback=post_xml_callback)
  File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 5170, in _create_domain
    guest = libvirt_guest.Guest.create(xml, self._host)
  File "/opt/stack/nova/nova/virt/libvirt/guest.py", line 129, in create
    encodeutils.safe_decode(xml))
  File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
    self.force_reraise()
  File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
    six.reraise(self.type_, self.value, self.tb)
  File "/opt/stack/nova/nova/virt/libvirt/guest.py", line 125, in create
    guest = host.write_instance_config(xml)
  File "/opt/stack/nova/nova/virt/libvirt/host.py", line 826, in write_instance_config
    domain = self.get_connection().defineXML(xml)
  File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 186, in doit
    result = proxy_call(self._autowrap, f, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 144, in proxy_call
    rv = execute(f, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 125, in execute
    six.reraise(c, e, tb)
  File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 83, in tworker
    rv = meth(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 3817, in defineXML
    ret = libvirtmod.virDomainDefineXML(self._o, xml)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u266b' in position 294: ordinal not in range(128)

Matt Riedemann (mriedem)
tags: added: i18n libvirt
summary: - Creating a VM with a non-ASCII name fails with an Unicode error
+ Creating a VM with a non-ASCII name fails with an Unicode error in
+ libvirt guest create()
Jiang (jiangpf)
Changed in nova:
assignee: nobody → Jiang (jiangpf)
Jiang (jiangpf)
Changed in nova:
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to nova (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/522149

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/522161

Changed in nova:
status: Confirmed → In Progress
Alex Xu (xuhj)
Changed in nova:
importance: Undecided → High
Changed in nova:
assignee: Jiang (jiangpf) → Yikun Jiang (yikunkero)
Andrey Volkov (avolkov)
tags: added: queens-rc-potential
Revision history for this message
Matt Riedemann (mriedem) wrote :

Was this caused by some regression in the Queens release or is this a latent issue? If it's latent, then it doesn't really need the queens-rc-potential tag.

Revision history for this message
Andrey Volkov (avolkov) wrote :

I did not find how it was broken yet but there is no such issue with devstack pike.

Revision history for this message
Matt Riedemann (mriedem) wrote :

I've posted a patch to Tempest to see if we can recreate the bug and see in which branches it fails:

https://review.openstack.org/#/c/542232/

Changed in nova:
assignee: Yikun Jiang (yikunkero) → Matt Riedemann (mriedem)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/522161
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=784c0ecdc37e7a2ac5e9b5ad9de4f5d88190a7dc
Submitter: Zuul
Branch: master

commit 784c0ecdc37e7a2ac5e9b5ad9de4f5d88190a7dc
Author: JiangPF <email address hidden>
Date: Wed Jan 31 18:36:33 2018 +0800

    Encode libvirt domain XML in UTF-8

    Creating a VM with a non-ASCII name results in an error. Resolve
    this by encoding the libvirt domain XML in utf-8.

    Co-Authored-By: Yikun Jiang <email address hidden>

    Closes-Bug: #1730756
    Change-Id: I7afce618deca3baaa96605a6b48c1c2ef4a5f2a5

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 17.0.0.0rc1

This issue was fixed in the openstack/nova 17.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/pike)

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/542831

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (stable/pike)

Change abandoned by Lee Yarwood (<email address hidden>) on branch: stable/pike
Review: https://review.openstack.org/542831

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Stephen Finucane (<email address hidden>) on branch: master
Review: https://review.opendev.org/522149
Reason: I've no idea what this is supposed to address, so I'm going to abandon. If you can reopen and update the commit message, I will re-review

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.