yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #87139
[Bug 1943436] Re: nova-manage db version fails with: AttributeError: 'Engine' object has no attribute 'get_main_option'
Reviewed: https://review.opendev.org/c/openstack/nova/+/808712
Committed: https://opendev.org/openstack/nova/commit/a3597530069aa7b55b1d3a033f50e0deebcb9786
Submitter: "Zuul (22348)"
Branch: master
commit a3597530069aa7b55b1d3a033f50e0deebcb9786
Author: Balazs Gibizer <balazs.gibizer@xxxxxxxx>
Date: Mon Sep 13 14:07:12 2021 +0200
Fix nova-manage db version
When nova switched to alembic implementation was added to nova-manage db
version CLI to query the current db revision from alembic. However
multiple mistake was made.
The code called alembic_api.current[1] with an Engine object while that
call expects a Config object instead. This leads to but/1943436.
Also the same code expected that this call returns the revision. But
that call just prints the revision to the standard output instead.
So the implementations has been change from calling the alembic command
API which is mostly created for CLI consumption to
MigrationContext.get_current_revision() call that is intended to be used
as a python API instead.
[1] https://alembic.sqlalchemy.org/en/latest/api/commands.html#alembic.command.current
Co-Authored-By: Sean Mooney <smooney@xxxxxxxxxx>
Closes-Bug: #1943436
Change-Id: I9fa7c03310c5bdb82e9a9c39727edb12eeae77f0
** Changed in: nova
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1943436
Title:
nova-manage db version fails with: AttributeError: 'Engine' object has
no attribute 'get_main_option'
Status in OpenStack Compute (nova):
Fix Released
Bug description:
It seems that after the alembic change merged the nova-manage db sync
fails with an exception:
stack@aio:/opt/stack/nova$ nova-manage db version
/usr/lib/python3/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes
/usr/lib/python3/dist-packages/secretstorage/util.py:19: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes
DEBUG migrate.versioning.repository [-] Loading repository /opt/stack/nova/nova/db/main/legacy_migrations... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/repository.py:76}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/417_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/417_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/413_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/413_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/405_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/405_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/422_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/422_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/415_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/415_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/419_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/419_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/408_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/408_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/410_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/410_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/403_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/403_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/412_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/412_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/402_train.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/402_train.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/406_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/406_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/407_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/407_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/420_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/420_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/414_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/414_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/418_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/418_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/404_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/404_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/409_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/409_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/421_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/421_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/416_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/416_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.script.base [-] Loading script /opt/stack/nova/nova/db/main/legacy_migrations/versions/411_placeholder.py... {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:27}}
DEBUG migrate.versioning.script.base [-] Script /opt/stack/nova/nova/db/main/legacy_migrations/versions/411_placeholder.py loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/script/base.py:30}}
DEBUG migrate.versioning.repository [-] Repository /opt/stack/nova/nova/db/main/legacy_migrations loaded successfully {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/repository.py:82}}
DEBUG migrate.versioning.repository [-] Config: {'db_settings': {'repository_id': 'nova', 'version_table': 'migrate_version', 'required_dbs': '[]'}} {{(pid=122970) __init__ /usr/local/lib/python3.8/dist-packages/migrate/versioning/repository.py:83}}
INFO alembic.runtime.migration [-] Context impl MySQLImpl.
INFO alembic.runtime.migration [-] Will assume non-transactional DDL.
An error has occurred:
Traceback (most recent call last):
File "/opt/stack/nova/nova/cmd/manage.py", line 3178, in main
ret = fn(*fn_args, **fn_kwargs)
File "/opt/stack/nova/nova/cmd/manage.py", line 224, in version
print(migration.db_version())
File "/opt/stack/nova/nova/db/migration.py", line 173, in db_version
alembic_version = alembic_api.current(engine)
File "/usr/local/lib/python3.8/dist-packages/alembic/command.py", line 527, in current
script = ScriptDirectory.from_config(config)
File "/usr/local/lib/python3.8/dist-packages/alembic/script/base.py", line 150, in from_config
script_location = config.get_main_option("script_location")
AttributeError: 'Engine' object has no attribute 'get_main_option'
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1943436/+subscriptions
References