Loading backend stores is not conditional and fails if optional dependencies are missing

Bug #1426767 reported by Oleg Gashev
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
glance_store
Fix Released
Medium
Ian Cordasco

Bug Description

# pip list|grep glance
glance (2015.1.dev40)
glance-store (0.1.11)

# /usr/bin/glance-api
2015-02-28 15:21:25.949 23107 ERROR stevedore.extension [-] Could not load 's3': No module named boto.exception
2015-02-28 15:21:25.950 23107 ERROR stevedore.extension [-] No module named boto.exception
2015-02-28 15:21:25.950 23107 TRACE stevedore.extension Traceback (most recent call last):
2015-02-28 15:21:25.950 23107 TRACE stevedore.extension File "/usr/lib/python2.7/site-packages/stevedore/extension.py", line 162, in _load_plugins
2015-02-28 15:21:25.950 23107 TRACE stevedore.extension verify_requirements,
2015-02-28 15:21:25.950 23107 TRACE stevedore.extension File "/usr/lib/python2.7/site-packages/stevedore/extension.py", line 185, in _load_one_plugin
2015-02-28 15:21:25.950 23107 TRACE stevedore.extension plugin = ep.load(require=verify_requirements)
2015-02-28 15:21:25.950 23107 TRACE stevedore.extension File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2025, in load
2015-02-28 15:21:25.950 23107 TRACE stevedore.extension entry = __import__(self.module_name, globals(),globals(), ['__name__'])
2015-02-28 15:21:25.950 23107 TRACE stevedore.extension File "/usr/lib/python2.7/site-packages/glance_store/_drivers/s3.py", line 26, in <module>
2015-02-28 15:21:25.950 23107 TRACE stevedore.extension import boto.exception
2015-02-28 15:21:25.950 23107 TRACE stevedore.extension ImportError: No module named boto.exception
2015-02-28 15:21:25.950 23107 TRACE stevedore.extension
2015-02-28 15:21:26.033 23107 ERROR stevedore.extension [-] Could not load 'glance.store.s3.Store': No module named boto.exception
2015-02-28 15:21:26.034 23107 ERROR stevedore.extension [-] No module named boto.exception
2015-02-28 15:21:26.034 23107 TRACE stevedore.extension Traceback (most recent call last):
2015-02-28 15:21:26.034 23107 TRACE stevedore.extension File "/usr/lib/python2.7/site-packages/stevedore/extension.py", line 162, in _load_plugins
2015-02-28 15:21:26.034 23107 TRACE stevedore.extension verify_requirements,
2015-02-28 15:21:26.034 23107 TRACE stevedore.extension File "/usr/lib/python2.7/site-packages/stevedore/extension.py", line 185, in _load_one_plugin
2015-02-28 15:21:26.034 23107 TRACE stevedore.extension plugin = ep.load(require=verify_requirements)
2015-02-28 15:21:26.034 23107 TRACE stevedore.extension File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2025, in load
2015-02-28 15:21:26.034 23107 TRACE stevedore.extension entry = __import__(self.module_name, globals(),globals(), ['__name__'])
2015-02-28 15:21:26.034 23107 TRACE stevedore.extension File "/usr/lib/python2.7/site-packages/glance_store/_drivers/s3.py", line 26, in <module>
2015-02-28 15:21:26.034 23107 TRACE stevedore.extension import boto.exception
2015-02-28 15:21:26.034 23107 TRACE stevedore.extension ImportError: No module named boto.exception
2015-02-28 15:21:26.034 23107 TRACE stevedore.extension

boto does not exist to glance_store requirements.

After boto installation, issue was fixed.

Oleg Gashev (oleg-f)
Changed in glance:
assignee: nobody → Oleg Gashev (oleg-f)
Revision history for this message
Oleg Gashev (oleg-f) wrote :
Changed in glance:
status: New → In Progress
Revision history for this message
Matt Riedemann (mriedem) wrote :

This is also a problem for the vmware backend if you don't have oslo.vmware installed which is also an optional dependency in test-requirements.txt.

Revision history for this message
Matt Riedemann (mriedem) wrote :

It's also a problem for gridfs with pymongo, the only difference there is pymongo is tested in the gate with ceilometer so it's always there, that's why we don't see the problem.

summary: - On exec glance-api displayed exception "ImportError: No module named
- boto.exception".
+ Loading backend stores is not conditional and fails if optional
+ dependencies are missing
Changed in glance:
importance: Undecided → Medium
Revision history for this message
Matt Riedemann (mriedem) wrote :

Note that the gridfs unit tests skip if pymongo isn't loaded:

https://github.com/openstack/glance_store/blob/master/tests/unit/test_gridfs_store.py#L101

That's why it gets away with not having pymongo listed in test-requirements.txt.

Revision history for this message
Ian Cordasco (icordasc) wrote :

See https://review.openstack.org/#/c/161428/ for a simpler solution that does not add boto as a requirement.

affects: glance → glance-store
Changed in glance-store:
assignee: Oleg Gashev (oleg-f) → Ian Cordasco (icordasc)
milestone: none → v0.1.13
Revision history for this message
Sabari Murugesan (smurugesan) wrote :

I do not think this is a bug. The exception is just logged by stevedore and it doesn't stop from starting the g-api service.

Reference:- https://github.com/dreamhost/stevedore/blame/master/stevedore/extension.py#L140
Stevedore doesn't create the extension if its not able to load the plugin from the entry_point. Thus, in the case of glance_store, the store is never loaded and the store scheme will just be unrecognized.

Revision history for this message
Sabari Murugesan (smurugesan) wrote :

^^ Clarification, I am only talking about the scenario when the store is not configured in glance_store.store.

If the store is configured in glance_store.store, then g-api will fail to start with ImportError. I think the user then needs to install the optional dependency. In case of oslo.vmware, its still in the requirements of glance. I see that boto was removed recently.

Isn't the import error the right behavior, if the store is configured in glance-api.conf ?

Revision history for this message
Nikhil Komawar (nikhil-komawar) wrote :
Changed in glance-store:
status: In Progress → Fix Committed
Changed in glance-store:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/glance_store 0.4.0

This issue was fixed in the openstack/glance_store 0.4.0 release.

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.