libvirt: boot instance with utf-8 name results in UnicodeDecodeError

Bug #1388386 reported by Matt Riedemann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Matt Riedemann
Juno
Fix Released
Undecided
Unassigned

Bug Description

With the libvirt driver and Juno 2014.2 code, try to boot a server via Horizon with name "ABC一丁七ÇàâアイウДфэبتثअइउ€¥噂ソ十豹竹敷" results in:

http://paste.openstack.org/show/128060/

This is new in Juno but was a latent issue since Icehouse, the Juno change was:

https://github.com/openstack/nova/commit/60c90f73261efb8c73ecc02152307c81265cab13

The err variable is an i18n Message object and when we try to put the domain.XMLDesc(0) into the unicode _LE message object string it blows up in oslo.i18n because the encoding doesn't match.

The fix is to wrap domain.XMLDesc(0) in oslo.utils.encodeutils.safe_decode.

Matt Riedemann (mriedem)
Changed in nova:
status: New → Triaged
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/132408

Changed in nova:
status: Triaged → In Progress
Matt Riedemann (mriedem)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/132408
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=e7c5896fa5db657750a361c44105624de0859d43
Submitter: Jenkins
Branch: master

commit e7c5896fa5db657750a361c44105624de0859d43
Author: Matt Riedemann <email address hidden>
Date: Sat Nov 1 09:33:17 2014 -0700

    libvirt: safe_decode domain.XMLDesc(0) for i18n logging

    domain.XMLDesc(0) can return a utf-8 encoded string which will cause a
    UnicodeDecodeError when substituting the variable in the _LE unicode
    translated Message object in oslo.i18n.

    This change simply decodes domain.XMLDesc(0) before passing it onto the
    logging method when used with a translated message.

    Closes-Bug: #1388386

    Change-Id: Id56d6564cfb15cc479e664020ae6f1c82acacb09

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/juno)

Fix proposed to branch: stable/juno
Review: https://review.openstack.org/141877

Thierry Carrez (ttx)
Changed in nova:
milestone: none → kilo-1
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/juno)

Reviewed: https://review.openstack.org/141877
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=eb58ed4f9a1c3a3e228cb7183d2dd8c1d74fd0c2
Submitter: Jenkins
Branch: stable/juno

commit eb58ed4f9a1c3a3e228cb7183d2dd8c1d74fd0c2
Author: Matt Riedemann <email address hidden>
Date: Sat Nov 1 09:33:17 2014 -0700

    libvirt: safe_decode domain.XMLDesc(0) for i18n logging

    domain.XMLDesc(0) can return a utf-8 encoded string which will cause a
    UnicodeDecodeError when substituting the variable in the _LE unicode
    translated Message object in oslo.i18n.

    This change simply decodes domain.XMLDesc(0) before passing it onto the
    logging method when used with a translated message.

    Changes in original commit code is required because in stable/juno branch
    library oslo.utils is not used, so original commit is changed to use
    utils from nova/openstack/common instead of oslo.utils library

    Closes-Bug: #1388386

    Conflicts:
     nova/tests/virt/libvirt/test_driver.py
     nova/virt/libvirt/driver.py

    Change-Id: Id56d6564cfb15cc479e664020ae6f1c82acacb09
    (cherry picked from commit e7c5896fa5db657750a361c44105624de0859d43)

tags: added: in-stable-juno
Thierry Carrez (ttx)
Changed in nova:
milestone: kilo-1 → 2015.1.0
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.