tags field with unicode cannot be correctly displayed

Bug #1669683 reported by Zhenyu Zheng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
Fix Released
High
Zhenyu Zheng
Ocata
Fix Committed
High
Matt Riedemann

Bug Description

When show instances with unicode tags, Chinese tags for example, it cannot be correctly
transformed: as the example below, name can be correctly transformed, but tags can't

root@zhenyu-dev:/usr/local/lib/python2.7/dist-packages/novaclient/v2# nova show 61bece8b-f211-47c8-8b34-28dd9bd8eb0a
+--------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Property | Value |
+--------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | zhenyu-dev |
| OS-EXT-SRV-ATTR:hostname | test-tag |
| OS-EXT-SRV-ATTR:hypervisor_hostname | zhenyu-dev |
| OS-EXT-SRV-ATTR:instance_name | instance-0000000c |
| OS-EXT-SRV-ATTR:kernel_id | d5bc48b8-2592-4fe4-bc2c-6e4d33df8ac9 |
| OS-EXT-SRV-ATTR:launch_index | 0 |
| OS-EXT-SRV-ATTR:ramdisk_id | a38171d1-2068-43c1-9165-ff55c3c72c81 |
| OS-EXT-SRV-ATTR:reservation_id | r-gthky26y |
| OS-EXT-SRV-ATTR:root_device_name | /dev/vda |
| OS-EXT-SRV-ATTR:user_data | - |
| OS-EXT-STS:power_state | 1 |
| OS-EXT-STS:task_state | - |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2017-03-02T02:16:37.000000 |
| OS-SRV-USG:terminated_at | - |
| accessIPv4 | |
| accessIPv6 | |
| config_drive | |
| created | 2017-03-02T02:16:28Z |
| description | - |
| flavor | m1.tiny (1) |
| hostId | d54347428394f3e5fdcd788abe731a30ee924d52e4457bc7101a4410 |
| host_status | UP |
| id | 61bece8b-f211-47c8-8b34-28dd9bd8eb0a |
| image | cirros-0.3.4-x86_64-uec (afbbcd5c-bed7-40a7-a9c0-0d4f57b05615) |
| key_name | - |
| locked | False |
| metadata | {} |
| name | 中文 |
| os-extended-volumes:volumes_attached | [] |
| private network | fdd5:9210:ec5b:0:f816:3eff:fedc:bfe9, 10.0.0.13 |
| progress | 0 |
| security_groups | default |
| status | ACTIVE |
| tags | ["\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\u4e00"] |
| tenant_id | b7c4a4d1de6b43f2bf013deee06400cd |
| updated | 2017-03-02T02:16:38Z |
| user_id | 59984487adce478494232df1cf41dbf9 |
+--------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

this is due to dict and list field are first transformed to string using jsondump:
http://git.openstack.org/cgit/openstack/python-novaclient/tree/novaclient/utils.py#n243
and thus cannot be correctly decoded afterwards.

And seems metadata will have the same problem as the operation is done to dict and list
fields.

description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-novaclient (master)

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

Changed in python-novaclient:
assignee: nobody → Zhenyu Zheng (zhengzhenyu)
status: New → In Progress
Matt Riedemann (mriedem)
Changed in python-novaclient:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (master)

Reviewed: https://review.openstack.org/440949
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=07971152413c3aa94e87b16f562acf686b9c5f48
Submitter: Jenkins
Branch: master

commit 07971152413c3aa94e87b16f562acf686b9c5f48
Author: Kevin_Zheng <email address hidden>
Date: Fri Mar 3 14:54:11 2017 +0800

    Tags and Metadata fields with unicode cannot be correctly displayed

    Currently, Tags(list) and Metadata(dict) fields of instance will
    firstly transformed to str using jsondump first when display. And
    cannot be correctly transfomed and displayed afterwards.

    This patch adds ensure_ascii=False to the transform function thus
    those fields can be correctly tranformed and displayed afterwards.

    Change-Id: Ib4e7a34f3b19db89280cc73053acbac8c8816f85
    Closes-Bug: #1669683

Changed in python-novaclient:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-novaclient (stable/ocata)

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/441693

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-novaclient 8.0.0

This issue was fixed in the openstack/python-novaclient 8.0.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (stable/ocata)

Reviewed: https://review.openstack.org/441693
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=50e571c23d7cdee527826d9eaa70d467b3e63d25
Submitter: Jenkins
Branch: stable/ocata

commit 50e571c23d7cdee527826d9eaa70d467b3e63d25
Author: Kevin_Zheng <email address hidden>
Date: Fri Mar 3 14:54:11 2017 +0800

    Tags and Metadata fields with unicode cannot be correctly displayed

    Currently, Tags(list) and Metadata(dict) fields of instance will
    firstly transformed to str using jsondump first when display. And
    cannot be correctly transfomed and displayed afterwards.

    This patch adds ensure_ascii=False to the transform function thus
    those fields can be correctly tranformed and displayed afterwards.

    Change-Id: Ib4e7a34f3b19db89280cc73053acbac8c8816f85
    Closes-Bug: #1669683
    (cherry picked from commit 07971152413c3aa94e87b16f562acf686b9c5f48)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-novaclient 7.1.1

This issue was fixed in the openstack/python-novaclient 7.1.1 release.

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.