glance-api failed to startup caused by UnicodeEncodeError in non-English environment

Bug #1202098 reported by gzy
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
Zhi Yan Liu

Bug Description

root@ubuntu:~/devstack# screen -x stack
There are screens on:
    4195.stack (2013年07月17日 08时11分11秒) (Dead ???)
    3733.stack (2013年07月17日 08时11分11秒) (Dead ???)
Remove dead screens with 'screen -wipe'.
There is no screen to be attached matching stack.

root@ubuntu:~/devstack# cat /var/log/glance/api.log
2013-07-17 11:26:10.880 14137 ERROR glance.store.sheepdog [-] 储存配置错误:Unexpected error while running command.
Command: collie
Exit code: 127
Stdout: ''
Stderr: '/bin/sh: 1: collie: not found\n'
2013-07-17 11:26:10.881 14137 CRITICAL glance [-] 'ascii' codec can't encode characters in position 0-7: ordinal not in range(128)
2013-07-17 14:08:33.500 14993 DEBUG glance.store [-] Attempting to import store glance.store.filesystem.Store _get_store_class /opt/stack/glance/glance/store/__init__.py:143
2013-07-17 14:08:33.501 14993 DEBUG glance.store [-] Registering store <class 'glance.store.filesystem.Store'> with schemes ('file', 'filesystem') create_stores /opt/stack/glance/glance/store/__init__.py:173
2013-07-17 14:08:33.507 14993 DEBUG glance.store.base [-] Late loading location class glance.store.filesystem.StoreLocation get_store_location_class /opt/stack/glance/glance/store/base.py:68
2013-07-17 14:08:33.507 14993 DEBUG glance.store.location [-] Registering scheme file with {'store_class': <class 'glance.store.filesystem.Store'>, 'location_class': <class 'glance.store.filesystem.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 14:08:33.507 14993 DEBUG glance.store.location [-] Registering scheme filesystem with {'store_class': <class 'glance.store.filesystem.Store'>, 'location_class': <class 'glance.store.filesystem.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 14:08:33.507 14993 DEBUG glance.store [-] Attempting to import store glance.store.http.Store _get_store_class /opt/stack/glance/glance/store/__init__.py:143
2013-07-17 14:08:33.508 14993 DEBUG glance.store [-] Registering store <class 'glance.store.http.Store'> with schemes ('http', 'https') create_stores /opt/stack/glance/glance/store/__init__.py:173
2013-07-17 14:08:33.508 14993 DEBUG glance.store.base [-] Late loading location class glance.store.http.StoreLocation get_store_location_class /opt/stack/glance/glance/store/base.py:68
2013-07-17 14:08:33.508 14993 DEBUG glance.store.location [-] Registering scheme http with {'store_class': <class 'glance.store.http.Store'>, 'location_class': <class 'glance.store.http.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 14:08:33.509 14993 DEBUG glance.store.location [-] Registering scheme https with {'store_class': <class 'glance.store.http.Store'>, 'location_class': <class 'glance.store.http.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 14:08:33.509 14993 DEBUG glance.store [-] Attempting to import store glance.store.rbd.Store _get_store_class /opt/stack/glance/glance/store/__init__.py:143
2013-07-17 14:08:33.510 14993 DEBUG glance.store [-] Registering store <class 'glance.store.rbd.Store'> with schemes ('rbd',) create_stores /opt/stack/glance/glance/store/__init__.py:173
2013-07-17 14:08:33.514 14993 DEBUG glance.store.base [-] Late loading location class glance.store.rbd.StoreLocation get_store_location_class /opt/stack/glance/glance/store/base.py:68
2013-07-17 14:08:33.514 14993 DEBUG glance.store.location [-] Registering scheme rbd with {'store_class': <class 'glance.store.rbd.Store'>, 'location_class': <class 'glance.store.rbd.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 14:08:33.515 14993 DEBUG glance.store [-] Attempting to import store glance.store.s3.Store _get_store_class /opt/stack/glance/glance/store/__init__.py:143
2013-07-17 14:08:33.515 14993 DEBUG glance.store [-] Registering store <class 'glance.store.s3.Store'> with schemes ('s3', 's3+http', 's3+https') create_stores /opt/stack/glance/glance/store/__init__.py:173
2013-07-17 14:08:33.516 14993 DEBUG glance.store.base [-] Late loading location class glance.store.s3.StoreLocation get_store_location_class /opt/stack/glance/glance/store/base.py:68
2013-07-17 14:08:33.516 14993 DEBUG glance.store.location [-] Registering scheme s3 with {'store_class': <class 'glance.store.s3.Store'>, 'location_class': <class 'glance.store.s3.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 14:08:33.517 14993 DEBUG glance.store.location [-] Registering scheme s3+http with {'store_class': <class 'glance.store.s3.Store'>, 'location_class': <class 'glance.store.s3.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 14:08:33.518 14993 DEBUG glance.store.location [-] Registering scheme s3+https with {'store_class': <class 'glance.store.s3.Store'>, 'location_class': <class 'glance.store.s3.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 14:08:33.518 14993 DEBUG glance.store [-] Attempting to import store glance.store.swift.Store _get_store_class /opt/stack/glance/glance/store/__init__.py:143
2013-07-17 14:08:33.564 14993 DEBUG glance.store [-] Registering store <function Store at 0xa8e8cdc> with schemes ('swift+https', 'swift', 'swift+http') create_stores /opt/stack/glance/glance/store/__init__.py:173
2013-07-17 14:08:33.564 14993 DEBUG glance.store.base [-] Late loading location class glance.store.swift.StoreLocation get_store_location_class /opt/stack/glance/glance/store/base.py:68
2013-07-17 14:08:33.565 14993 DEBUG glance.store.location [-] Registering scheme swift+https with {'store_class': <function Store at 0xa8e8cdc>, 'location_class': <class 'glance.store.swift.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 14:08:33.565 14993 DEBUG glance.store.location [-] Registering scheme swift+http with {'store_class': <function Store at 0xa8e8cdc>, 'location_class': <class 'glance.store.swift.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 14:08:33.565 14993 DEBUG glance.store.location [-] Registering scheme swift with {'store_class': <function Store at 0xa8e8cdc>, 'location_class': <class 'glance.store.swift.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 14:08:33.566 14993 DEBUG glance.store [-] Attempting to import store glance.store.sheepdog.Store _get_store_class /opt/stack/glance/glance/store/__init__.py:143
2013-07-17 14:08:33.576 14993 DEBUG glance.openstack.common.processutils [-] Running cmd (subprocess): collie execute /opt/stack/glance/glance/openstack/common/processutils.py:142
2013-07-17 14:08:33.593 14993 DEBUG glance.openstack.common.processutils [-] Result was 127 execute /opt/stack/glance/glance/openstack/common/processutils.py:167
2013-07-17 14:08:33.594 14993 ERROR glance.store.sheepdog [-] 储存配置错误:Unexpected error while running command.
Command: collie
Exit code: 127
Stdout: ''
Stderr: '/bin/sh: 1: collie: not found\n'
2013-07-17 14:08:33.595 14993 CRITICAL glance [-] 'ascii' codec can't encode characters in position 0-7: ordinal not in range(128)
2013-07-17 14:08:33.595 14993 TRACE glance Traceback (most recent call last):
2013-07-17 14:08:33.595 14993 TRACE glance File "/usr/local/bin/glance-api", line 9, in <module>
2013-07-17 14:08:33.595 14993 TRACE glance load_entry_point('glance==2013.2.a112.g99f6dda', 'console_scripts', 'glance-api')()
2013-07-17 14:08:33.595 14993 TRACE glance File "/opt/stack/glance/glance/cmd/api.py", line 57, in main
2013-07-17 14:08:33.595 14993 TRACE glance glance.store.create_stores()
2013-07-17 14:08:33.595 14993 TRACE glance File "/opt/stack/glance/glance/store/__init__.py", line 164, in create_stores
2013-07-17 14:08:33.595 14993 TRACE glance store_instance = store_cls()
2013-07-17 14:08:33.595 14993 TRACE glance File "/opt/stack/glance/glance/store/base.py", line 44, in __init__
2013-07-17 14:08:33.595 14993 TRACE glance "Disabling add method." % e)
2013-07-17 14:08:33.595 14993 TRACE glance UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-7: ordinal not in range(128)
2013-07-17 14:08:33.595 14993 TRACE glance

Zhi Yan Liu (lzy-dev)
description: updated
Changed in glance:
assignee: nobody → Zhi Yan Liu (lzy-dev)
gzy (937429866-o)
Changed in glance:
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

Changed in glance:
status: Confirmed → In Progress
Revision history for this message
Zhi Yan Liu (lzy-dev) wrote :
Download full text (29.5 KiB)

After applied above #37421 patch, the glance-api can running well. Verification log:

2013-07-17 16:05:08.235 15824 DEBUG glance.store [-] Attempting to import store glance.store.filesystem.Store _get_store_class /opt/stack/glance/glance/store/__init__.py:143
2013-07-17 16:05:08.236 15824 DEBUG glance.store [-] Registering store <class 'glance.store.filesystem.Store'> with schemes ('file', 'filesystem') create_stores /opt/stack/glance/glance/store/__init__.py:173
2013-07-17 16:05:08.237 15824 DEBUG glance.store.base [-] Late loading location class glance.store.filesystem.StoreLocation get_store_location_class /opt/stack/glance/glance/store/base.py:70
2013-07-17 16:05:08.237 15824 DEBUG glance.store.location [-] Registering scheme file with {'store_class': <class 'glance.store.filesystem.Store'>, 'location_class': <class 'glance.store.filesystem.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 16:05:08.237 15824 DEBUG glance.store.location [-] Registering scheme filesystem with {'store_class': <class 'glance.store.filesystem.Store'>, 'location_class': <class 'glance.store.filesystem.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 16:05:08.237 15824 DEBUG glance.store [-] Attempting to import store glance.store.http.Store _get_store_class /opt/stack/glance/glance/store/__init__.py:143
2013-07-17 16:05:08.237 15824 DEBUG glance.store [-] Registering store <class 'glance.store.http.Store'> with schemes ('http', 'https') create_stores /opt/stack/glance/glance/store/__init__.py:173
2013-07-17 16:05:08.238 15824 DEBUG glance.store.base [-] Late loading location class glance.store.http.StoreLocation get_store_location_class /opt/stack/glance/glance/store/base.py:70
2013-07-17 16:05:08.238 15824 DEBUG glance.store.location [-] Registering scheme http with {'store_class': <class 'glance.store.http.Store'>, 'location_class': <class 'glance.store.http.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 16:05:08.238 15824 DEBUG glance.store.location [-] Registering scheme https with {'store_class': <class 'glance.store.http.Store'>, 'location_class': <class 'glance.store.http.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 16:05:08.238 15824 DEBUG glance.store [-] Attempting to import store glance.store.rbd.Store _get_store_class /opt/stack/glance/glance/store/__init__.py:143
2013-07-17 16:05:08.239 15824 DEBUG glance.store [-] Registering store <class 'glance.store.rbd.Store'> with schemes ('rbd',) create_stores /opt/stack/glance/glance/store/__init__.py:173
2013-07-17 16:05:08.239 15824 DEBUG glance.store.base [-] Late loading location class glance.store.rbd.StoreLocation get_store_location_class /opt/stack/glance/glance/store/base.py:70
2013-07-17 16:05:08.239 15824 DEBUG glance.store.location [-] Registering scheme rbd with {'store_class': <class 'glance.store.rbd.Store'>, 'location_class': <class 'glance.store.rbd.StoreLocation'>} register_scheme_map /opt/stack/glance/glance/store/location.py:85
2013-07-17 16:05:08.239 15824 DEBUG glance.store [-] Attempting to import store ...

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

Reviewed: https://review.openstack.org/37421
Committed: http://github.com/openstack/glance/commit/ee461194fa163ce97e7758cda28d7af6e6773ae4
Submitter: Jenkins
Branch: master

commit ee461194fa163ce97e7758cda28d7af6e6773ae4
Author: Zhi Yan Liu <email address hidden>
Date: Wed Jul 17 16:22:09 2013 +0800

    Using unicode() convert non-English exception message

    In non-English environment when the store driver loading failed, the
    BackendException will be raised with a non-ascii message. We need call
    unicode() to convert the message before using it.

    Fixes bug 1202098

    Change-Id: I9a58393b599aacc427cb4135988ecf5c3e90e455
    Signed-off-by: Zhi Yan Liu <email address hidden>

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

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

Zhi Yan Liu (lzy-dev)
Changed in glance:
status: Fix Committed → In Progress
Changed in glance:
milestone: none → havana-rc1
Changed in glance:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/44490
Committed: http://github.com/openstack/glance/commit/71985de2968b693805031a7134922d738c3d720e
Submitter: Jenkins
Branch: master

commit 71985de2968b693805031a7134922d738c3d720e
Author: Zhi Yan Liu <email address hidden>
Date: Sat Aug 31 00:11:50 2013 +0800

    Convert non-English exception message when a store loading error

    In non-English environment when a store driver loading failed then a
    BackendException will be raised with a non-ascii message. So we need
    convert
    any coded exception message to unicode string for logging.

    This patch fixed a minor defect in
    https://review.openstack.org/#/c/37421/
    And the test case has be enhanced also.

    Fixes bug 1202098

    Related-Id: I9a58393b599aacc427cb4135988ecf5c3e90e455
    Change-Id: I1cdc71537fc1205e5fa4ff9744b441e5d88c1d04
    Signed-off-by: Zhi Yan Liu <email address hidden>

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: havana-rc1 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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