← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1848449] [NEW] DB Migration fails on upgrade from Stein to Train

 

Public bug reported:

su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf   --config-file /etc/neutron/plugins/ml2/ml2_conf.ini --config-file /etc/neutron/neutron_fwaas.conf upgrade head" neutron
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
  Running upgrade for neutron ...
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade 63fd95af7dcd -> c613d0b82681
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1236, in _execute_context
    cursor, statement, parameters, context
  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 536, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 165, in execute
    result = self._query(query)
  File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 321, in _query
    conn.query(q)
  File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 860, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1061, in _read_query_result
    result.read()
  File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1349, in read
    first_packet = self.connection._read_packet()
  File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1018, in _read_packet
    packet.check_error()
  File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 384, in check_error
    err.raise_mysql_exception(self._data)
  File "/usr/lib/python3/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.InternalError: (1832, "Cannot change column 'network_id': used in a foreign key constraint 'subnets_ibfk_1'")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/neutron-db-manage", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3/dist-packages/neutron/db/migration/cli.py", line 657, in main
    return_val |= bool(CONF.command.func(config, CONF.command.name))
  File "/usr/lib/python3/dist-packages/neutron/db/migration/cli.py", line 181, in do_upgrade
    desc=branch, sql=CONF.command.sql)
  File "/usr/lib/python3/dist-packages/neutron/db/migration/cli.py", line 82, in do_alembic_command
    getattr(alembic_command, cmd)(config, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/alembic/command.py", line 254, in upgrade
    script.run_env()
  File "/usr/lib/python3/dist-packages/alembic/script/base.py", line 427, in run_env
    util.load_python_file(self.dir, 'env.py')
  File "/usr/lib/python3/dist-packages/alembic/util/pyfiles.py", line 81, in load_python_file
    module = load_module_py(module_id, path)
  File "/usr/lib/python3/dist-packages/alembic/util/compat.py", line 82, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/neutron/db/migration/alembic_migrations/env.py", line 120, in <module>
    run_migrations_online()
  File "/usr/lib/python3/dist-packages/neutron/db/migration/alembic_migrations/env.py", line 114, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/usr/lib/python3/dist-packages/alembic/runtime/environment.py", line 836, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/usr/lib/python3/dist-packages/alembic/runtime/migration.py", line 330, in run_migrations
    step.migration_fn(**kw)
  File "/usr/lib/python3/dist-packages/neutron/db/migration/alembic_migrations/versions/train/expand/c613d0b82681_subnet_force_network_id.py", line 35, in upgrade
    existing_type=sa.String(36))
  File "<string>", line 8, in alter_column
  File "<string>", line 3, in alter_column
  File "/usr/lib/python3/dist-packages/alembic/operations/ops.py", line 1444, in alter_column
    return operations.invoke(alt)
  File "/usr/lib/python3/dist-packages/alembic/operations/base.py", line 319, in invoke
    return fn(self, operation)
  File "/usr/lib/python3/dist-packages/alembic/operations/toimpl.py", line 53, in alter_column
    **operation.kw
  File "/usr/lib/python3/dist-packages/alembic/ddl/mysql.py", line 68, in alter_column
    else existing_autoincrement
  File "/usr/lib/python3/dist-packages/alembic/ddl/impl.py", line 115, in _exec
    return conn.execute(construct, *multiparams, **params)
  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 980, in execute
    return meth(self, multiparams, params)
  File "/usr/lib/python3/dist-packages/sqlalchemy/sql/ddl.py", line 72, in _execute_on_connection
    return connection._execute_ddl(self, multiparams, params)
  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1042, in _execute_ddl
    compiled,
  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1240, in _execute_context
    e, statement, parameters, cursor, context
  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1456, in _handle_dbapi_exception
    util.raise_from_cause(newraise, exc_info)
  File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 296, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 276, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1236, in _execute_context
    cursor, statement, parameters, context
  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 536, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 165, in execute
    result = self._query(query)
  File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 321, in _query
    conn.query(q)
  File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 860, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1061, in _read_query_result
    result.read()
  File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1349, in read
    first_packet = self.connection._read_packet()
  File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1018, in _read_packet
    packet.check_error()
  File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 384, in check_error
    err.raise_mysql_exception(self._data)
  File "/usr/lib/python3/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
oslo_db.exception.DBError: (pymysql.err.InternalError) (1832, "Cannot change column 'network_id': used in a foreign key constraint 'subnets_ibfk_1'") [SQL: 'ALTER TABLE subnets MODIFY network_id VARCHAR(36) NOT NULL'] (Background on this error at: http://sqlalche.me/e/2j85)


hX ~ # dpkg -l | grep neutron
ii  neutron-common                       2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - common
ii  neutron-dhcp-agent                   2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - DHCP agent
ii  neutron-fwaas-common                 1:15.0.0~rc1-0ubuntu3~cloud0                   all          Firewall-as-a-Service driver for OpenStack Neutron
ii  neutron-l3-agent                     2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - l3 agent
ii  neutron-linuxbridge-agent            2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - linuxbridge agent
ii  neutron-metadata-agent               2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - metadata agent
ii  neutron-plugin-ml2                   2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - ML2 plugin
ii  neutron-server                       2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - server
ii  python3-neutron                      2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - Python library
ii  python3-neutron-fwaas                1:15.0.0~rc1-0ubuntu3~cloud0                   all          Firewall-as-a-Service driver for OpenStack Neutron
ii  python3-neutron-fwaas-dashboard      1:2.1.0-0ubuntu1~cloud0                        all          OpenStack Firewall as a Service - dashboard plugin
ii  python3-neutron-lib                  1.29.1-0ubuntu1~cloud0                         all          Neutron shared routines and utilities - Python 3.x
ii  python3-neutronclient                1:6.7.0-0ubuntu1                               all          client API library for Neutron - Python 3.x

** Affects: neutron
     Importance: Undecided
         Status: New

** Description changed:

  su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf   --config-file /etc/neutron/plugins/ml2/ml2_conf.ini --config-file /etc/neutron/neutron_fwaas.conf upgrade head" neutron
  INFO  [alembic.runtime.migration] Context impl MySQLImpl.
  INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
-   Running upgrade for neutron ...
+   Running upgrade for neutron ...
  INFO  [alembic.runtime.migration] Context impl MySQLImpl.
  INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
  INFO  [alembic.runtime.migration] Running upgrade 63fd95af7dcd -> c613d0b82681
  Traceback (most recent call last):
-   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1236, in _execute_context
-     cursor, statement, parameters, context
-   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 536, in do_execute
-     cursor.execute(statement, parameters)
-   File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 165, in execute
-     result = self._query(query)
-   File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 321, in _query
-     conn.query(q)
-   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 860, in query
-     self._affected_rows = self._read_query_result(unbuffered=unbuffered)
-   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1061, in _read_query_result
-     result.read()
-   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1349, in read
-     first_packet = self.connection._read_packet()
-   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1018, in _read_packet
-     packet.check_error()
-   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 384, in check_error
-     err.raise_mysql_exception(self._data)
-   File "/usr/lib/python3/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
-     raise errorclass(errno, errval)
+   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1236, in _execute_context
+     cursor, statement, parameters, context
+   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 536, in do_execute
+     cursor.execute(statement, parameters)
+   File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 165, in execute
+     result = self._query(query)
+   File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 321, in _query
+     conn.query(q)
+   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 860, in query
+     self._affected_rows = self._read_query_result(unbuffered=unbuffered)
+   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1061, in _read_query_result
+     result.read()
+   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1349, in read
+     first_packet = self.connection._read_packet()
+   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1018, in _read_packet
+     packet.check_error()
+   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 384, in check_error
+     err.raise_mysql_exception(self._data)
+   File "/usr/lib/python3/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
+     raise errorclass(errno, errval)
  pymysql.err.InternalError: (1832, "Cannot change column 'network_id': used in a foreign key constraint 'subnets_ibfk_1'")
  
  The above exception was the direct cause of the following exception:
  
  Traceback (most recent call last):
-   File "/usr/bin/neutron-db-manage", line 10, in <module>
-     sys.exit(main())
-   File "/usr/lib/python3/dist-packages/neutron/db/migration/cli.py", line 657, in main
-     return_val |= bool(CONF.command.func(config, CONF.command.name))
-   File "/usr/lib/python3/dist-packages/neutron/db/migration/cli.py", line 181, in do_upgrade
-     desc=branch, sql=CONF.command.sql)
-   File "/usr/lib/python3/dist-packages/neutron/db/migration/cli.py", line 82, in do_alembic_command
-     getattr(alembic_command, cmd)(config, *args, **kwargs)
-   File "/usr/lib/python3/dist-packages/alembic/command.py", line 254, in upgrade
-     script.run_env()
-   File "/usr/lib/python3/dist-packages/alembic/script/base.py", line 427, in run_env
-     util.load_python_file(self.dir, 'env.py')
-   File "/usr/lib/python3/dist-packages/alembic/util/pyfiles.py", line 81, in load_python_file
-     module = load_module_py(module_id, path)
-   File "/usr/lib/python3/dist-packages/alembic/util/compat.py", line 82, in load_module_py
-     spec.loader.exec_module(module)
-   File "<frozen importlib._bootstrap_external>", line 678, in exec_module
-   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
-   File "/usr/lib/python3/dist-packages/neutron/db/migration/alembic_migrations/env.py", line 120, in <module>
-     run_migrations_online()
-   File "/usr/lib/python3/dist-packages/neutron/db/migration/alembic_migrations/env.py", line 114, in run_migrations_online
-     context.run_migrations()
-   File "<string>", line 8, in run_migrations
-   File "/usr/lib/python3/dist-packages/alembic/runtime/environment.py", line 836, in run_migrations
-     self.get_context().run_migrations(**kw)
-   File "/usr/lib/python3/dist-packages/alembic/runtime/migration.py", line 330, in run_migrations
-     step.migration_fn(**kw)
-   File "/usr/lib/python3/dist-packages/neutron/db/migration/alembic_migrations/versions/train/expand/c613d0b82681_subnet_force_network_id.py", line 35, in upgrade
-     existing_type=sa.String(36))
-   File "<string>", line 8, in alter_column
-   File "<string>", line 3, in alter_column
-   File "/usr/lib/python3/dist-packages/alembic/operations/ops.py", line 1444, in alter_column
-     return operations.invoke(alt)
-   File "/usr/lib/python3/dist-packages/alembic/operations/base.py", line 319, in invoke
-     return fn(self, operation)
-   File "/usr/lib/python3/dist-packages/alembic/operations/toimpl.py", line 53, in alter_column
-     **operation.kw
-   File "/usr/lib/python3/dist-packages/alembic/ddl/mysql.py", line 68, in alter_column
-     else existing_autoincrement
-   File "/usr/lib/python3/dist-packages/alembic/ddl/impl.py", line 115, in _exec
-     return conn.execute(construct, *multiparams, **params)
-   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 980, in execute
-     return meth(self, multiparams, params)
-   File "/usr/lib/python3/dist-packages/sqlalchemy/sql/ddl.py", line 72, in _execute_on_connection
-     return connection._execute_ddl(self, multiparams, params)
-   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1042, in _execute_ddl
-     compiled,
-   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1240, in _execute_context
-     e, statement, parameters, cursor, context
-   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1456, in _handle_dbapi_exception
-     util.raise_from_cause(newraise, exc_info)
-   File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 296, in raise_from_cause
-     reraise(type(exception), exception, tb=exc_tb, cause=cause)
-   File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 276, in reraise
-     raise value.with_traceback(tb)
-   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1236, in _execute_context
-     cursor, statement, parameters, context
-   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 536, in do_execute
-     cursor.execute(statement, parameters)
-   File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 165, in execute
-     result = self._query(query)
-   File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 321, in _query
-     conn.query(q)
-   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 860, in query
-     self._affected_rows = self._read_query_result(unbuffered=unbuffered)
-   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1061, in _read_query_result
-     result.read()
-   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1349, in read
-     first_packet = self.connection._read_packet()
-   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1018, in _read_packet
-     packet.check_error()
-   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 384, in check_error
-     err.raise_mysql_exception(self._data)
-   File "/usr/lib/python3/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
-     raise errorclass(errno, errval)
+   File "/usr/bin/neutron-db-manage", line 10, in <module>
+     sys.exit(main())
+   File "/usr/lib/python3/dist-packages/neutron/db/migration/cli.py", line 657, in main
+     return_val |= bool(CONF.command.func(config, CONF.command.name))
+   File "/usr/lib/python3/dist-packages/neutron/db/migration/cli.py", line 181, in do_upgrade
+     desc=branch, sql=CONF.command.sql)
+   File "/usr/lib/python3/dist-packages/neutron/db/migration/cli.py", line 82, in do_alembic_command
+     getattr(alembic_command, cmd)(config, *args, **kwargs)
+   File "/usr/lib/python3/dist-packages/alembic/command.py", line 254, in upgrade
+     script.run_env()
+   File "/usr/lib/python3/dist-packages/alembic/script/base.py", line 427, in run_env
+     util.load_python_file(self.dir, 'env.py')
+   File "/usr/lib/python3/dist-packages/alembic/util/pyfiles.py", line 81, in load_python_file
+     module = load_module_py(module_id, path)
+   File "/usr/lib/python3/dist-packages/alembic/util/compat.py", line 82, in load_module_py
+     spec.loader.exec_module(module)
+   File "<frozen importlib._bootstrap_external>", line 678, in exec_module
+   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
+   File "/usr/lib/python3/dist-packages/neutron/db/migration/alembic_migrations/env.py", line 120, in <module>
+     run_migrations_online()
+   File "/usr/lib/python3/dist-packages/neutron/db/migration/alembic_migrations/env.py", line 114, in run_migrations_online
+     context.run_migrations()
+   File "<string>", line 8, in run_migrations
+   File "/usr/lib/python3/dist-packages/alembic/runtime/environment.py", line 836, in run_migrations
+     self.get_context().run_migrations(**kw)
+   File "/usr/lib/python3/dist-packages/alembic/runtime/migration.py", line 330, in run_migrations
+     step.migration_fn(**kw)
+   File "/usr/lib/python3/dist-packages/neutron/db/migration/alembic_migrations/versions/train/expand/c613d0b82681_subnet_force_network_id.py", line 35, in upgrade
+     existing_type=sa.String(36))
+   File "<string>", line 8, in alter_column
+   File "<string>", line 3, in alter_column
+   File "/usr/lib/python3/dist-packages/alembic/operations/ops.py", line 1444, in alter_column
+     return operations.invoke(alt)
+   File "/usr/lib/python3/dist-packages/alembic/operations/base.py", line 319, in invoke
+     return fn(self, operation)
+   File "/usr/lib/python3/dist-packages/alembic/operations/toimpl.py", line 53, in alter_column
+     **operation.kw
+   File "/usr/lib/python3/dist-packages/alembic/ddl/mysql.py", line 68, in alter_column
+     else existing_autoincrement
+   File "/usr/lib/python3/dist-packages/alembic/ddl/impl.py", line 115, in _exec
+     return conn.execute(construct, *multiparams, **params)
+   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 980, in execute
+     return meth(self, multiparams, params)
+   File "/usr/lib/python3/dist-packages/sqlalchemy/sql/ddl.py", line 72, in _execute_on_connection
+     return connection._execute_ddl(self, multiparams, params)
+   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1042, in _execute_ddl
+     compiled,
+   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1240, in _execute_context
+     e, statement, parameters, cursor, context
+   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1456, in _handle_dbapi_exception
+     util.raise_from_cause(newraise, exc_info)
+   File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 296, in raise_from_cause
+     reraise(type(exception), exception, tb=exc_tb, cause=cause)
+   File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 276, in reraise
+     raise value.with_traceback(tb)
+   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1236, in _execute_context
+     cursor, statement, parameters, context
+   File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 536, in do_execute
+     cursor.execute(statement, parameters)
+   File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 165, in execute
+     result = self._query(query)
+   File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 321, in _query
+     conn.query(q)
+   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 860, in query
+     self._affected_rows = self._read_query_result(unbuffered=unbuffered)
+   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1061, in _read_query_result
+     result.read()
+   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1349, in read
+     first_packet = self.connection._read_packet()
+   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1018, in _read_packet
+     packet.check_error()
+   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 384, in check_error
+     err.raise_mysql_exception(self._data)
+   File "/usr/lib/python3/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
+     raise errorclass(errno, errval)
  oslo_db.exception.DBError: (pymysql.err.InternalError) (1832, "Cannot change column 'network_id': used in a foreign key constraint 'subnets_ibfk_1'") [SQL: 'ALTER TABLE subnets MODIFY network_id VARCHAR(36) NOT NULL'] (Background on this error at: http://sqlalche.me/e/2j85)
+ 
+ 
+ hX ~ # dpkg -l | grep neutron
+ ii  neutron-common                       2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - common
+ ii  neutron-dhcp-agent                   2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - DHCP agent
+ ii  neutron-fwaas-common                 1:15.0.0~rc1-0ubuntu3~cloud0                   all          Firewall-as-a-Service driver for OpenStack Neutron
+ ii  neutron-l3-agent                     2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - l3 agent
+ ii  neutron-linuxbridge-agent            2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - linuxbridge agent
+ ii  neutron-metadata-agent               2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - metadata agent
+ ii  neutron-plugin-ml2                   2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - ML2 plugin
+ ii  neutron-server                       2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - server
+ ii  python3-neutron                      2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - Python library
+ ii  python3-neutron-fwaas                1:15.0.0~rc1-0ubuntu3~cloud0                   all          Firewall-as-a-Service driver for OpenStack Neutron
+ ii  python3-neutron-fwaas-dashboard      1:2.1.0-0ubuntu1~cloud0                        all          OpenStack Firewall as a Service - dashboard plugin
+ ii  python3-neutron-lib                  1.29.1-0ubuntu1~cloud0                         all          Neutron shared routines and utilities - Python 3.x
+ ii  python3-neutronclient                1:6.7.0-0ubuntu1                               all          client API library for Neutron - Python 3.x

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1848449

Title:
  DB Migration fails on upgrade from Stein to Train

Status in neutron:
  New

Bug description:
  su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf   --config-file /etc/neutron/plugins/ml2/ml2_conf.ini --config-file /etc/neutron/neutron_fwaas.conf upgrade head" neutron
  INFO  [alembic.runtime.migration] Context impl MySQLImpl.
  INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
    Running upgrade for neutron ...
  INFO  [alembic.runtime.migration] Context impl MySQLImpl.
  INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
  INFO  [alembic.runtime.migration] Running upgrade 63fd95af7dcd -> c613d0b82681
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1236, in _execute_context
      cursor, statement, parameters, context
    File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 536, in do_execute
      cursor.execute(statement, parameters)
    File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 165, in execute
      result = self._query(query)
    File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 321, in _query
      conn.query(q)
    File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 860, in query
      self._affected_rows = self._read_query_result(unbuffered=unbuffered)
    File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1061, in _read_query_result
      result.read()
    File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1349, in read
      first_packet = self.connection._read_packet()
    File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1018, in _read_packet
      packet.check_error()
    File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 384, in check_error
      err.raise_mysql_exception(self._data)
    File "/usr/lib/python3/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
      raise errorclass(errno, errval)
  pymysql.err.InternalError: (1832, "Cannot change column 'network_id': used in a foreign key constraint 'subnets_ibfk_1'")

  The above exception was the direct cause of the following exception:

  Traceback (most recent call last):
    File "/usr/bin/neutron-db-manage", line 10, in <module>
      sys.exit(main())
    File "/usr/lib/python3/dist-packages/neutron/db/migration/cli.py", line 657, in main
      return_val |= bool(CONF.command.func(config, CONF.command.name))
    File "/usr/lib/python3/dist-packages/neutron/db/migration/cli.py", line 181, in do_upgrade
      desc=branch, sql=CONF.command.sql)
    File "/usr/lib/python3/dist-packages/neutron/db/migration/cli.py", line 82, in do_alembic_command
      getattr(alembic_command, cmd)(config, *args, **kwargs)
    File "/usr/lib/python3/dist-packages/alembic/command.py", line 254, in upgrade
      script.run_env()
    File "/usr/lib/python3/dist-packages/alembic/script/base.py", line 427, in run_env
      util.load_python_file(self.dir, 'env.py')
    File "/usr/lib/python3/dist-packages/alembic/util/pyfiles.py", line 81, in load_python_file
      module = load_module_py(module_id, path)
    File "/usr/lib/python3/dist-packages/alembic/util/compat.py", line 82, in load_module_py
      spec.loader.exec_module(module)
    File "<frozen importlib._bootstrap_external>", line 678, in exec_module
    File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
    File "/usr/lib/python3/dist-packages/neutron/db/migration/alembic_migrations/env.py", line 120, in <module>
      run_migrations_online()
    File "/usr/lib/python3/dist-packages/neutron/db/migration/alembic_migrations/env.py", line 114, in run_migrations_online
      context.run_migrations()
    File "<string>", line 8, in run_migrations
    File "/usr/lib/python3/dist-packages/alembic/runtime/environment.py", line 836, in run_migrations
      self.get_context().run_migrations(**kw)
    File "/usr/lib/python3/dist-packages/alembic/runtime/migration.py", line 330, in run_migrations
      step.migration_fn(**kw)
    File "/usr/lib/python3/dist-packages/neutron/db/migration/alembic_migrations/versions/train/expand/c613d0b82681_subnet_force_network_id.py", line 35, in upgrade
      existing_type=sa.String(36))
    File "<string>", line 8, in alter_column
    File "<string>", line 3, in alter_column
    File "/usr/lib/python3/dist-packages/alembic/operations/ops.py", line 1444, in alter_column
      return operations.invoke(alt)
    File "/usr/lib/python3/dist-packages/alembic/operations/base.py", line 319, in invoke
      return fn(self, operation)
    File "/usr/lib/python3/dist-packages/alembic/operations/toimpl.py", line 53, in alter_column
      **operation.kw
    File "/usr/lib/python3/dist-packages/alembic/ddl/mysql.py", line 68, in alter_column
      else existing_autoincrement
    File "/usr/lib/python3/dist-packages/alembic/ddl/impl.py", line 115, in _exec
      return conn.execute(construct, *multiparams, **params)
    File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 980, in execute
      return meth(self, multiparams, params)
    File "/usr/lib/python3/dist-packages/sqlalchemy/sql/ddl.py", line 72, in _execute_on_connection
      return connection._execute_ddl(self, multiparams, params)
    File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1042, in _execute_ddl
      compiled,
    File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1240, in _execute_context
      e, statement, parameters, cursor, context
    File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1456, in _handle_dbapi_exception
      util.raise_from_cause(newraise, exc_info)
    File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 296, in raise_from_cause
      reraise(type(exception), exception, tb=exc_tb, cause=cause)
    File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 276, in reraise
      raise value.with_traceback(tb)
    File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1236, in _execute_context
      cursor, statement, parameters, context
    File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 536, in do_execute
      cursor.execute(statement, parameters)
    File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 165, in execute
      result = self._query(query)
    File "/usr/lib/python3/dist-packages/pymysql/cursors.py", line 321, in _query
      conn.query(q)
    File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 860, in query
      self._affected_rows = self._read_query_result(unbuffered=unbuffered)
    File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1061, in _read_query_result
      result.read()
    File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1349, in read
      first_packet = self.connection._read_packet()
    File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1018, in _read_packet
      packet.check_error()
    File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 384, in check_error
      err.raise_mysql_exception(self._data)
    File "/usr/lib/python3/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
      raise errorclass(errno, errval)
  oslo_db.exception.DBError: (pymysql.err.InternalError) (1832, "Cannot change column 'network_id': used in a foreign key constraint 'subnets_ibfk_1'") [SQL: 'ALTER TABLE subnets MODIFY network_id VARCHAR(36) NOT NULL'] (Background on this error at: http://sqlalche.me/e/2j85)


  hX ~ # dpkg -l | grep neutron
  ii  neutron-common                       2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - common
  ii  neutron-dhcp-agent                   2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - DHCP agent
  ii  neutron-fwaas-common                 1:15.0.0~rc1-0ubuntu3~cloud0                   all          Firewall-as-a-Service driver for OpenStack Neutron
  ii  neutron-l3-agent                     2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - l3 agent
  ii  neutron-linuxbridge-agent            2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - linuxbridge agent
  ii  neutron-metadata-agent               2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - metadata agent
  ii  neutron-plugin-ml2                   2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - ML2 plugin
  ii  neutron-server                       2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - server
  ii  python3-neutron                      2:15.0.0~rc1-0ubuntu1~cloud0                   all          Neutron is a virtual network service for Openstack - Python library
  ii  python3-neutron-fwaas                1:15.0.0~rc1-0ubuntu3~cloud0                   all          Firewall-as-a-Service driver for OpenStack Neutron
  ii  python3-neutron-fwaas-dashboard      1:2.1.0-0ubuntu1~cloud0                        all          OpenStack Firewall as a Service - dashboard plugin
  ii  python3-neutron-lib                  1.29.1-0ubuntu1~cloud0                         all          Neutron shared routines and utilities - Python 3.x
  ii  python3-neutronclient                1:6.7.0-0ubuntu1                               all          client API library for Neutron - Python 3.x

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1848449/+subscriptions