mongodb driver version detection fails for versions containing "-"

Bug #1709607 reported by Cristian Calin on 2017-08-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zaqar
Undecided
Cristian Calin

Bug Description

The mongodb driver contains a function parsing the mongodb version.

https://github.com/openstack/zaqar/blob/master/zaqar/storage/mongodb/driver.py#L85

tuple(map(int, server_info.split('.')))

This assumes that the server_info contains only integers split by '.'. Some versions of mongo (like percona release) add extra build identifiers and this function fails leading to the driver failing to initialize.

The fix is to only use the first two components of the split array in the map call.

Changed in zaqar:
assignee: nobody → Cristian Calin (cristi-calin)

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

Changed in zaqar:
status: New → In Progress
Cristian Calin (cristi-calin) wrote :

Here is a stack trace:

2017-08-11 09:06:03.215 12 DEBUG zaqar.storage.pooling [(None,) e254bbd5536541eb9589e2b9821d473f 768965fd91054b73a9765592e602fcfa - - -] No pool found for queue my_queue for project 768965fd91054b73a9765592e602fcfa lookup /opt/zaqar/lib/python2.7/site-packages/zaqar/storage/pooling.py:680
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils [(None,) e254bbd5536541eb9589e2b9821d473f 768965fd91054b73a9765592e602fcfa - - -] Failed to load "zaqar.data.storage" driver for "mongodb"
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils [(None,) e254bbd5536541eb9589e2b9821d473f 768965fd91054b73a9765592e602fcfa - - -] invalid literal for int() with base 10: '10-1'
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils Traceback (most recent call last):
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils File "/opt/zaqar/lib/python2.7/site-packages/zaqar/storage/utils.py", line 141, in load_storage_driver
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils invoke_args=_invoke_args)
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils File "/opt/zaqar/lib/python2.7/site-packages/stevedore/driver.py", line 61, in __init__
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils warn_on_missing_entrypoint=warn_on_missing_entrypoint
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils File "/opt/zaqar/lib/python2.7/site-packages/stevedore/named.py", line 81, in __init__
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils verify_requirements)
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils File "/opt/zaqar/lib/python2.7/site-packages/stevedore/extension.py", line 194, in _load_plugins
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils self._on_load_failure_callback(self, ep, err)
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils File "/opt/zaqar/lib/python2.7/site-packages/stevedore/extension.py", line 186, in _load_plugins
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils verify_requirements,
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils File "/opt/zaqar/lib/python2.7/site-packages/stevedore/named.py", line 158, in _load_one_plugin
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils verify_requirements,
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils File "/opt/zaqar/lib/python2.7/site-packages/stevedore/extension.py", line 218, in _load_one_plugin
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils obj = plugin(*invoke_args, **invoke_kwds)
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils File "/opt/zaqar/lib/python2.7/site-packages/zaqar/storage/mongodb/driver.py", line 85, in __init__
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils self.server_version = tuple(map(int, server_info.split('.')))
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils ValueError: invalid literal for int() with base 10: '10-1'
2017-08-11 09:06:03.235 12 ERROR zaqar.storage.utils

Cristian Calin (cristi-calin) wrote :

The version of mongodb I'm using is Percona MongoDB 3.0.10-1.5. The extra "-" breaks the parsing.

MongoDB shell version: 3.0.10-1.5
connecting to: test
ceilometer:PRIMARY> db.version()
3.0.10-1.5

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers