Fix database migrations and disable the non-standalone job

The pattern of adding a column and then reading a table with it
no longer works in SQLAlchemy 1.3.20. This has been reported
upstream [1] and apparently we're doing the wrong thing by reusing
a column object twice.

We need to disable the non-standalone job since it's really broken
now, and this fix is blocking bifrost.

[1] https://github.com/sqlalchemy/sqlalchemy/issues/5669

Change-Id: I2fb07413e8f421f39b24acf1272771ee2097b195
This commit is contained in:
Dmitry Tantsur 2020-10-23 15:02:28 +02:00
parent 2e6f5ed25b
commit 5678f219cd
4 changed files with 16 additions and 6 deletions

View File

@ -63,7 +63,8 @@ def upgrade():
node_uuid_column = sa.Column(NODE_UUID, sa.String(36)) node_uuid_column = sa.Column(NODE_UUID, sa.String(36))
op.add_column(ATTRIBUTES, node_uuid_column) op.add_column(ATTRIBUTES, node_uuid_column)
attributes = sa.table(ATTRIBUTES, node_uuid_column, attributes = sa.table(ATTRIBUTES,
sa.Column(NODE_UUID, sa.String(36)),
sa.Column(UUID, sa.String(36))) sa.Column(UUID, sa.String(36)))
with op.batch_alter_table(ATTRIBUTES, with op.batch_alter_table(ATTRIBUTES,

View File

@ -32,17 +32,22 @@ depends_on = None
def upgrade(): def upgrade():
started_at = sa.Column('started_at', sa.types.Float, nullable=True)
finished_at = sa.Column('finished_at', sa.types.Float, nullable=True)
temp_started_at = sa.Column("temp_started_at", sa.types.DateTime, temp_started_at = sa.Column("temp_started_at", sa.types.DateTime,
nullable=True) nullable=True)
temp_finished_at = sa.Column("temp_finished_at", sa.types.DateTime, temp_finished_at = sa.Column("temp_finished_at", sa.types.DateTime,
nullable=True) nullable=True)
uuid = sa.Column("uuid", sa.String(36), primary_key=True)
op.add_column("nodes", temp_started_at) op.add_column("nodes", temp_started_at)
op.add_column("nodes", temp_finished_at) op.add_column("nodes", temp_finished_at)
uuid = sa.Column("uuid", sa.String(36), primary_key=True)
started_at = sa.Column('started_at', sa.types.Float, nullable=True)
finished_at = sa.Column('finished_at', sa.types.Float, nullable=True)
# NOTE(dtantsur): do not reuse the column objects from add_column
temp_started_at = sa.Column("temp_started_at", sa.types.DateTime,
nullable=True)
temp_finished_at = sa.Column("temp_finished_at", sa.types.DateTime,
nullable=True)
t = sa.table('nodes', started_at, finished_at, t = sa.table('nodes', started_at, finished_at,
temp_started_at, temp_finished_at, uuid) temp_started_at, temp_finished_at, uuid)

View File

@ -0,0 +1,4 @@
---
fixes:
- |
Fixes database migrations with SQLAlchemy 1.3.20.

View File

@ -11,7 +11,8 @@
- ironic-inspector-grenade - ironic-inspector-grenade
- ironic-inspector-tempest - ironic-inspector-tempest
- ironic-inspector-tempest-discovery - ironic-inspector-tempest-discovery
- ironic-inspector-tempest-managed-non-standalone - ironic-inspector-tempest-managed-non-standalone:
voting: false
- openstack-tox-functional-py38 - openstack-tox-functional-py38
- bifrost-integration-tinyipa-ubuntu-bionic: - bifrost-integration-tinyipa-ubuntu-bionic:
voting: false voting: false
@ -23,5 +24,4 @@
- ironic-inspector-grenade - ironic-inspector-grenade
- ironic-inspector-tempest - ironic-inspector-tempest
- ironic-inspector-tempest-discovery - ironic-inspector-tempest-discovery
- ironic-inspector-tempest-managed-non-standalone
- openstack-tox-functional-py38 - openstack-tox-functional-py38