Skip to content

Magnum db-sync fails with "Duplicate column name 'stack_id'" on fresh install #1542

Description

@sykim-etri

Describe the bug

On a fresh install, magnum-db-sync fails with:
sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError)
(1060, "Duplicate column name 'stack_id'")
[SQL: ALTER TABLE nodegroup ADD COLUMN stack_id VARCHAR(255)]

Has anyone else encountered this issue?

To Reproduce

  1. Fresh Genestack deployment (no previous Magnum data)
  2. Run install-magnum.sh
  3. magnum-db-sync Job enters CrashLoopBackOff

Expected behavior

magnum-db-manage upgrade completes successfully.

Server

  • OS: Ubuntu 22.04
  • Magnum image: ghcr.io/rackerlabs/genestack-images/magnum:2025.1-latest
  • MariaDB: Galera cluster via mariadb-operator

Additional context

Reproducible on two independent baremetal environments. We believe migration ac92cbae311c imports from magnum.db.sqlalchemy import models which loads the current model metadata, causing op.create_table to
create the nodegroup table with extra columns that a later migration (c04e925e65c2) tries to add again.

Current workaround:
magnum-db-manage stamp head

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions