Should not read config options while update cells

Bug #1793423 reported by Zhenyu Zheng on 2018-09-20
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Zhenyu Zheng

Bug Description

When perform ``nova-manage cell_v2 update_cell`` command,
we read the ``database_connection`` and ``transport_url`` from
configuration file if the caller don't provide this info:
and they are latter saved with

this is problematic because:
1.If I did not pass config file with --config-file, it will use the file from default route and most probably it will be cell0 file, when I did not pass ``transport_url``
and/or ``database_connection`` this will lead to that those file will be overridden
by the value in the conf, which will fail in the latter uniqueness check as we already
have the cell_0 db mapped.
2.If I pass the nova-cell1.conf with --config-file, the command will probably unable to
run because I do not have api_database connection in the config file as I should not
perform upcall.
3. It seems not appropriate at all that I have to always provide the config file for
the cell I want to update when I call update cell, as I'm only updating a record in
the API_DB.

root@ubuntu:/opt/stack/nova# nova-manage cell_v2 list_cells
| Name | UUID | Transport URL | Database Connection | Disabled |
| cell0 | 00000000-0000-0000-0000-000000000000 | none:/ | mysql+pymysql://root:****@ | False |
| cell1 | 8eea3d64-2624-4d55-aa81-996fc8017402 | rabbit://stackrabbit:****@ | mysql+pymysql://root:****@ | False |

for case 1:
root@ubuntu:/opt/stack/nova# nova-manage --config-file /etc/nova/nova.conf cell_v2 update_cell --cell_uuid 8eea3d64-2624-4d55-aa81-996fc8017402 --disable
transport_url and/or database_connection combination already exists for another cell with uuid 00000000-0000-0000-0000-000000000000.

for case2:
root@ubuntu:/opt/stack/nova# nova-manage --config-file /etc/nova/nova_cell1.conf cell_v2 update_cell --cell_uuid 8eea3d64-2624-4d55-aa81-996fc8017402 --disable
An error has occurred:
Traceback (most recent call last):
  File "/opt/stack/nova/nova/cmd/", line 2323, in main
    ret = fn(*fn_args, **fn_kwargs)
  File "/opt/stack/nova/nova/cmd/", line 1629, in update_cell
    cell_mapping = objects.CellMapping.get_by_uuid(ctxt, cell_uuid)
  File "/usr/local/lib/python2.7/dist-packages/oslo_versionedobjects/", line 184, in wrapper
    result = fn(cls, context, *args, **kwargs)
  File "/opt/stack/nova/nova/objects/", line 182, in get_by_uuid
    db_mapping = cls._get_by_uuid_from_db(context, uuid)
  File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/", line 992, in wrapper
    with self._transaction_scope(context):
  File "/usr/lib/python2.7/", line 17, in __enter__
  File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/", line 1042, in _transaction_scope
    context=context) as resource:
  File "/usr/lib/python2.7/", line 17, in __enter__
  File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/", line 645, in _session
    bind=self.connection, mode=self.mode)
  File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/", line 409, in _create_session
  File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/", line 496, in _start
    engine_args, maker_args)
  File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/", line 518, in _setup_for_connection
    "No sql_connection parameter is established")
CantStartEngineError: No sql_connection parameter is established

description: updated
description: updated
description: updated

Fix proposed to branch: master

Changed in nova:
assignee: nobody → Zhenyu Zheng (zhengzhenyu)
status: New → In Progress

Change abandoned by Zhenyu Zheng (<email address hidden>) on branch: master
Reason: This is made this way on purpose

Changed in nova:
status: In Progress → Invalid
Matt Riedemann (mriedem) wrote :

I've marked this as a duplicate of bug 1829852 since it's related. Though this bug came first, there is an active change for bug 1829852.

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

Other bug subscribers