devstack installation crashes when nova migrating

Bug #1951741 reported by Samuel Chen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.db
New
Undecided
Unassigned

Bug Description

When I was installing DevStack (victoria) on a CentOS 8.4 (arm64) host, It crashed while executing Nova migration.

It occured on the step "/usr/local/bin/nova-manage --config-file /etc/nova/nova_cell1.conf db sync --local_cell".

The exception as below :
```
An error has occurred:
Traceback (most recent call last):
  File "/opt/stack/nova/nova/cmd/manage.py", line 2793, in main
    ret = fn(*fn_args, **fn_kwargs)
  File "/opt/stack/nova/nova/cmd/manage.py", line 202, in sync
    return migration.db_sync(version)
  File "/opt/stack/nova/nova/db/migration.py", line 26, in db_sync
    return IMPL.db_sync(version=version, database=database, context=context)
  File "/opt/stack/nova/nova/db/sqlalchemy/migration.py", line 56, in db_sync
    return versioning_api.upgrade(get_engine(database, context=context),
  File "/usr/local/lib/python3.8/site-packages/migrate/versioning/api.py", line 186, in upgrade
    return _migrate(url, repository, version, upgrade=True, err=err, **opts)
  File "/usr/local/lib/python3.8/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/usr/local/lib/python3.8/site-packages/migrate/versioning/util/__init__.py", line 167, in with_engine
    return f(*a, **kw)
  File "/usr/local/lib/python3.8/site-packages/migrate/versioning/api.py", line 366, in _migrate
    schema.runchange(ver, change, changeset.step)
  File "/usr/local/lib/python3.8/site-packages/migrate/versioning/schema.py", line 93, in runchange
    change.run(self.engine, step)
  File "/usr/local/lib/python3.8/site-packages/migrate/versioning/script/py.py", line 154, in run
    script_func(engine)
  File "/opt/stack/nova/nova/db/sqlalchemy/migrate_repo/versions/230_add_details_column_to_instance_actions_events.py", line 29, in upgrade
    actions_events.create_column(host)
  File "/usr/local/lib/python3.8/site-packages/migrate/changeset/schema.py", line 489, in create_column
    column.create(table=self, *p, **kw)
  File "/usr/local/lib/python3.8/site-packages/migrate/changeset/schema.py", line 591, in create
    visitorcallable = get_engine_visitor(engine, 'columngenerator')
  File "/usr/local/lib/python3.8/site-packages/migrate/changeset/databases/visitor.py", line 47, in get_engine_visitor
    return get_dialect_visitor(engine.dialect, name)
AttributeError: 'NoneType' object has no attribute 'dialect'
```

I tried to fixed it by changing `oslo_db.sqlalcheymy.utils.get_table` like this (bind engine to metadata):
```
metadata = MetaData(engine)
```

This issue can be reproduced by the following code:
```
from sqlalchemy import *

engine = create_engine('mysql+pymysql://root:123456@127.0.0.1/nova_cell1?charset=utf8')
metadata = MetaData(engine)
table = Table('instance_actions_events', metadata, autoload_with=engine)
print(table.bind)
```

environment:

nova 22.3.1.dev2 /opt/stack/nova
SQLAlchemy 1.4.27
sqlalchemy-migrate 0.13.0

oslo.cache 2.8.1
oslo.concurrency 4.5.0
oslo.config 8.7.1
oslo.context 3.4.0
**oslo.db 11.0.0**
oslo.i18n 5.1.0
oslo.limit 1.4.0
oslo.log 4.6.1
oslo.messaging 12.11.0
oslo.metrics 0.4.0
oslo.middleware 4.4.0
oslo.policy 3.9.0
oslo.privsep 2.6.2
oslo.reports 2.3.0
oslo.rootwrap 6.3.0
oslo.serialization 4.2.0
oslo.service 2.7.0
oslo.upgradecheck 1.4.0
oslo.utils 4.11.0
oslo.versionedobjects 2.5.0
oslo.vmware 3.10.0

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.