Glance image-list -> shell-init: error retrieving current directory

Bug #1356373 reported by Tzach Shefi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-keystoneclient
Expired
Low
Unassigned

Bug Description

Description of problem: During recreation of another bug on my setup AIO Neutron network, during instance snapshot process before snapshot completed uploading I did #glance image-list

root@orange-vdse tmptriyEJ(keystone_admin)]# glance image-list
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Traceback (most recent call last):
  File "/usr/bin/glance", line 6, in <module>
    from glanceclient.shell import main
  File "/usr/lib/python2.7/site-packages/glanceclient/shell.py", line 30, in <module>
    from keystoneclient.v2_0 import client as ksclient
  File "/usr/lib/python2.7/site-packages/keystoneclient/v2_0/__init__.py", line 2, in <module>
    from keystoneclient.v2_0.client import Client
  File "/usr/lib/python2.7/site-packages/keystoneclient/v2_0/client.py", line 20, in <module>
    from keystoneclient import httpclient
  File "/usr/lib/python2.7/site-packages/keystoneclient/httpclient.py", line 27, in <module>
    import keyring
  File "/usr/lib/python2.7/site-packages/keyring/__init__.py", line 12, in <module>
    from .core import (set_keyring, get_keyring, set_password, get_password,
  File "/usr/lib/python2.7/site-packages/keyring/core.py", line 180, in <module>
    init_backend()
  File "/usr/lib/python2.7/site-packages/keyring/core.py", line 59, in init_backend
    set_keyring(load_config() or _get_best_keyring())
  File "/usr/lib/python2.7/site-packages/keyring/core.py", line 105, in load_config
    local_path = os.path.join(os.getcwd(), filename)
OSError: [Errno 2] No such file or directory

Version-Release number of selected component (if applicable):
RHEL7
python-glanceclient-0.13.1-1.el7ost.noarch
openstack-glance-2014.1.1-1.el7ost.noarch
python-glance-2014.1.1-1.el7ost.noarch
openstack-nova-compute-2014.1.1-4.el7ost.noarch

How reproducible:
Not sure first time, looks like a fluke one off problem to me.

Steps to Reproduce:
1. Booted an instance
2. Created a snapshot of that running instance
3. Before snapshot upload completed, ran glance image-list.

Actual results:
Glance image-list failed with above trace error

Expected results:
Glance image-list should worked without errors.

On attached Glance log ignore errors before this trace, related to other bug I was testing with low disk space case.

Revision history for this message
Tzach Shefi (tshefi) wrote :
Revision history for this message
Tzach Shefi (tshefi) wrote :

BTW forgot to mention running glance image-list a moment later worked fine.

Revision history for this message
Tzach Shefi (tshefi) wrote :

BTW2, just noticed something odd my pwd at the time of the command was
/var/lib/nova/instances/snapshots/tm.. temp folder of snapshot

I think the problem is related or was caused by sending the command from this temp folder as it failed again but once I moved up one folder back I didn't get this trace error again.

Revision history for this message
Louis Taylor (kragniz) wrote :

This is reproducible by deleting the cwd:

    $ mkdir ~/tmp
    $ cd ~/tmp
    $ rm -r ~/tmp
    $ glance image-list

I tested cinder and nova clients, and they fall over in the same way.

Changed in glance:
status: New → Confirmed
importance: Undecided → Wishlist
importance: Wishlist → Low
Revision history for this message
Louis Taylor (kragniz) wrote :

The root cause in all of the clients seems to be keystoneclient, so moving it over there.

affects: glance → python-keystoneclient
Revision history for this message
Jamie Lennox (jamielennox) wrote :

I can recreate this on F20 using the steps above, however the glance image-list, keystone user-list, nova list and others i tried all still succeed - they just print the error message.

[fedora@jamielennox-devstack-doa tmp]$ glance image-list
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
+--------------------------------------+---------------------------------+-------------+------------------+-----------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+--------------------------------------+---------------------------------+-------------+------------------+-----------+--------+
| b3477f20-8bfe-462d-a4a7-582f4a8a9466 | cirros-0.3.2-x86_64-uec | ami | ami | 25165824 | active |
| 01ed1994-b0da-40cb-b0a6-c483dbb03b9d | cirros-0.3.2-x86_64-uec-kernel | aki | aki | 4969360 | active |
| bd9f35c7-646f-4c13-91ff-b93a110bf7fa | cirros-0.3.2-x86_64-uec-ramdisk | ari | ari | 3723817 | active |
| ceb9ed6f-b394-47e3-8204-9e889e476aad | Fedora-x86_64-20-20140618-sda | qcow2 | bare | 209649664 | active |
+--------------------------------------+---------------------------------+-------------+------------------+-----------+--------+

It appears that it's coming from within the python-keyring module, trying to figure out whether there is a keyring file in the current directory. As there is no directory in this case it's getting confused.

If there is an actual exception being raised we can catch that around the import keyring as that's an optional dependency however it appears to just print and move on.

jiaxi (tjxiter)
Changed in python-keystoneclient:
assignee: nobody → jiaxi (tjxiter)
jiaxi (tjxiter)
Changed in python-keystoneclient:
assignee: jiaxi (tjxiter) → nobody
Revision history for this message
Steve Martinelli (stevemar) wrote :

We've pretty much wrapped every keyring import with try and excepts, so i'm not sure what else we can do. Ideally the debug logs should help

Changed in python-keystoneclient:
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for python-keystoneclient because there has been no activity for 60 days.]

Changed in python-keystoneclient:
status: Incomplete → Expired
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.