Use alembic alter_column for 35cb52c5553f migration

With latest sqlalchemy there is no alter attribute for the Column object

Thus, zun-db-manage upgrade fails with AttributeError. Instead of trying
to use SQLAlchemy for altering Column we should use alembic instead
for the migration

This also fix py3.11 job by replacing libmysqlclient-dev with
libmariadb-dev-compat which is available for both ubuntu and debian.

Closes-Bug: #2043209
Change-Id: Iaba736d391ad5820de5f481d2c5bac1714dc0809
This commit is contained in:
Dmitriy Rabotyagov 2023-11-10 15:17:52 +01:00
parent 541478084e
commit 397edf53c1
3 changed files with 11 additions and 11 deletions

View File

@ -14,11 +14,11 @@ numactl
# MySQL and PostgreSQL databases since some jobs are set up in # MySQL and PostgreSQL databases since some jobs are set up in
# OpenStack infra that need these like # OpenStack infra that need these like
libmysqlclient-dev [platform:dpkg test] libmariadb-dev-compat [platform:dpkg test]
mysql [platform:rpm test] mariadb [platform:rpm test]
mysql-client [platform:dpkg test] mariadb-client [platform:dpkg test]
mysql-devel [platform:rpm test] mariadb-devel [platform:rpm test]
mysql-server [test] mariadb-server [test]
postgresql [test] postgresql [test]
postgresql-client [platform:dpkg test] postgresql-client [platform:dpkg test]
postgresql-devel [platform:rpm test] postgresql-devel [platform:rpm test]

View File

@ -331,9 +331,8 @@ hostname = {
SIGNALS = ['None'] SIGNALS = ['None']
if sys.version_info >= (3, 5, 0): if sys.version_info >= (3, 5, 0):
signals = [n for n in signal.Signals] signals = [n.name for n in signal.Signals]
for s in signals: for s in signals:
s = str(s).split('.')[1]
SIGNALS.append(s) SIGNALS.append(s)
SIGNALS.append(s.replace('SIG', '')) SIGNALS.append(s.replace('SIG', ''))
SIGNALS.append(s.lower()) SIGNALS.append(s.lower())

View File

@ -29,7 +29,8 @@ import sqlalchemy as sa
def upgrade(): def upgrade():
volume_mapping_table = sa.Table( op.alter_column(
"volume_mapping", sa.MetaData(bind=op.get_bind()), 'volume_mapping', 'volume_id',
sa.Column('volume_id', sa.String(36), nullable=True)) new_column_name='cinder_volume_id',
volume_mapping_table.c.volume_id.alter(name='cinder_volume_id') type_=sa.String(36)
)