magnum-db-manage fails with "ValueError: invalid literal for int() with base 10: 'magnum.sqlite'" (incorrect use of oslo_db.options)

Bug #1749654 reported by Florian Haas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Magnum
Invalid
Undecided
Unassigned

Bug Description

Current stable/ocata comes with a magnum-db-manage that immediately appears to fail:

(magnum-15.1.16) root@alice-magnum-container-1d1bc27c:~# magnum-db-manage --help
Traceback (most recent call last):
  File "/openstack/venvs/magnum-15.1.16/bin/magnum-db-manage", line 7, in <module>
    from magnum.cmd.db_manage import main
  File "/openstack/venvs/magnum-15.1.16/lib/python2.7/site-packages/magnum/cmd/db_manage.py", line 18, in <module>
    from magnum.db import migration
  File "/openstack/venvs/magnum-15.1.16/lib/python2.7/site-packages/magnum/db/migration.py", line 21, in <module>
    import magnum.conf
  File "/openstack/venvs/magnum-15.1.16/lib/python2.7/site-packages/magnum/conf/__init__.py", line 54, in <module>
    database.register_opts(CONF)
  File "/openstack/venvs/magnum-15.1.16/lib/python2.7/site-packages/magnum/conf/database.py", line 34, in register_opts
    options.set_defaults(conf, _DEFAULT_SQL_CONNECTION, 'magnum.sqlite')
  File "/openstack/venvs/magnum-15.1.16/lib/python2.7/site-packages/oslo_db/options.py", line 203, in set_defaults
    conf.set_default('max_pool_size', max_pool_size, group='database')
  File "/openstack/venvs/magnum-15.1.16/lib/python2.7/site-packages/oslo_config/cfg.py", line 2436, in __inner
    result = f(self, *args, **kwargs)
  File "/openstack/venvs/magnum-15.1.16/lib/python2.7/site-packages/oslo_config/cfg.py", line 2774, in set_default
    opt_info['opt'], default)
  File "/openstack/venvs/magnum-15.1.16/lib/python2.7/site-packages/oslo_config/cfg.py", line 2780, in _get_enforced_type_value
    return self._convert_value(value, opt)
  File "/openstack/venvs/magnum-15.1.16/lib/python2.7/site-packages/oslo_config/cfg.py", line 3051, in _convert_value
    return opt.type(value)
  File "/openstack/venvs/magnum-15.1.16/lib/python2.7/site-packages/oslo_config/types.py", line 309, in __call__
    value = self.num_type(value)
ValueError: invalid literal for int() with base 10: 'magnum.sqlite'

As far as i can tell, this is due to an incorrect use of set_defaults in conf.database.register_opts():

def register_opts(conf):
    conf.register_group(database_group)
    conf.register_opts(sql_opts, group=database_group)
    options.set_defaults(conf, _DEFAULT_SQL_CONNECTION, 'magnum.sqlite')

The signature for set_defaults does indeed expect a numerical value for the third argument:

def set_defaults(conf, connection=None, max_pool_size=None,
                 max_overflow=None, pool_timeout=None):

Clearly, 'magnum.sqlite' isn't a valid value for max_pool_size. It looks to me like that argument can simply be dropped from the set_defaults() invocation in register_opts() to make things work.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to magnum (stable/ocata)

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/544807

Revision history for this message
yatin (yatinkarel) wrote :

u-c for oslo.db is 4.17.1 which should work perfectly, issue seems to be because you must have oslo.db >= 4.19.0. Please check oslo.db version you have using: pip show oslo.db.
If wrong version is installed then that should be fixed. The proposed change should be avoided.

Revision history for this message
Florian Haas (fghaas) wrote :

Yatin, thanks for getting back to me. The reason I had assumed this couldn't be a version inconsistency was that this is a fresh Magnum install from openstack-ansible's stable/ocata branch. Let me look into whether I can nail this issue there.

Revision history for this message
Florian Haas (fghaas) wrote :

OK, so looking a bit further into this, this is the current Magnum requirements.txt for stable/ocata:

oslo.db>=4.15.0 # Apache-2.0

If this breaks in 4.19.0, shouldn't this be changed as follows?

oslo.db>=4.15.0,<4.19.0

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on magnum (stable/ocata)

Change abandoned by Florian Haas (<email address hidden>) on branch: stable/ocata
Review: https://review.openstack.org/544807

Revision history for this message
Florian Haas (fghaas) wrote :

I'm marking this one invalid. It appears that this issue is not in Magnum, but in the way openstack-ansible pulls in dependencies for venv builds. Sorry for the noise.

Changed in magnum:
status: New → Invalid
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.