[openstack-dev] Is shade (and os_client_config) thread safe?

Joshua Harlow harlowja at fastmail.com
Mon Aug 7 20:52:02 UTC 2017


Hi there folks,

I'm doing various scans of our clouds here at godaddy and using shade to 
do some of the calls.

Though when I do stuff like the following sometimes it has issues...

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

Typically this causes the following error:

Traceback (most recent call last):
   File "tools/fetch_flavors.py", line 72, in <module>
     main()
   File "tools/fetch_flavors.py", line 61, in main
     results.append(fut.result())
   File 
"/Users/jxharlow/.venv/lib/python2.7/site-packages/concurrent/futures/_base.py", 
line 422, in result
     return self.__get_result()
   File 
"/Users/jxharlow/.venv/lib/python2.7/site-packages/concurrent/futures/thread.py", 
line 62, in run
     result = self.fn(*self.args, **self.kwargs)
   File "tools/fetch_flavors.py", line 24, in extract_cloud
     client = shade.openstack_cloud(cloud=cloud_name)
   File 
"/Users/jxharlow/.venv/lib/python2.7/site-packages/shade/__init__.py", 
line 106, in openstack_cloud
     return OpenStackCloud(cloud_config=cloud_config, strict=strict)
   File 
"/Users/jxharlow/.venv/lib/python2.7/site-packages/shade/openstackcloud.py", 
line 156, in __init__
     self.image_api_use_tasks = cloud_config.config['image_api_use_tasks']
KeyError: 'image_api_use_tasks'

Though if I add a lock around the following then things go better:

with SHADE_LOCK:
     client = shade.openstack_cloud(cloud=cloud_name)

So that makes me wonder, is ummm, this library (or one of its 
dependencies not thread-safe?); has anyone else seen similar things, 
perhaps they've already been fixed?

-Josh



More information about the OpenStack-dev mailing list