← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1245502] Re: Grizzly -> Havana nova upgrade failure: Cannot drop index 'instance_uuid'

 

** Changed in: nova
       Status: Fix Committed => 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/1245502

Title:
  Grizzly -> Havana nova upgrade failure: Cannot drop index
  'instance_uuid'

Status in OpenStack Compute (Nova):
  Fix Released

Bug description:
  I was running Ubuntu 13.04 and upgraded to 13.10.  I was running the
  Ubuntu Precise 1:2013.1.3-0ubuntu1.1 on 13.04 and am now on 13.10's
  provided 1:2013.2~rc2-0ubuntu1.

  After getting the box up, migrating the nova database failed with the
  below error.  I am using MySQL.

  
  # nova-manage -v db sync
  2013-10-27 01:47:03.615 24457 INFO migrate.versioning.api [-] 161 -> 162...
  2013-10-27 01:47:03.673 24457 INFO migrate.versioning.api [-] done
  ...
  ...
  2013-10-27 01:47:16.373 24457 INFO migrate.versioning.api [-] 184 -> 185...
  Command failed, please check log for more info
  2013-10-27 01:47:17.835 24457 CRITICAL nova [-] (OperationalError) (1553, "Cannot drop index 'instance_uuid': needed in a foreign key constraint") 'ALTER TABLE instance_info_caches DROP INDEX instance_uuid' ()
  2013-10-27 01:47:17.835 24457 TRACE nova Traceback (most recent call last):
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/bin/nova-manage", line 10, in <module>
  2013-10-27 01:47:17.835 24457 TRACE nova     sys.exit(main())
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/cmd/manage.py", line 1377, in main
  2013-10-27 01:47:17.835 24457 TRACE nova     ret = fn(*fn_args, **fn_kwargs)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/cmd/manage.py", line 885, in sync
  2013-10-27 01:47:17.835 24457 TRACE nova     return migration.db_sync(version)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/db/migration.py", line 33, in db_sync
  2013-10-27 01:47:17.835 24457 TRACE nova     return IMPL.db_sync(version=version)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/migration.py", line 75, in db_sync
  2013-10-27 01:47:17.835 24457 TRACE nova     return versioning_api.upgrade(get_engine(), repository, version)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/migrate/versioning/api.py", line 186, in upgrade
  2013-10-27 01:47:17.835 24457 TRACE nova     return _migrate(url, repository, version, upgrade=True, err=err, **opts)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "<string>", line 2, in _migrate
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/migration.py", line 40, in patched_with_engine
  2013-10-27 01:47:17.835 24457 TRACE nova     return f(*a, **kw)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/migrate/versioning/api.py", line 366, in _migrate
  2013-10-27 01:47:17.835 24457 TRACE nova     schema.runchange(ver, change, changeset.step)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/migrate/versioning/schema.py", line 91, in runchange
  2013-10-27 01:47:17.835 24457 TRACE nova     change.run(self.engine, step)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/migrate/versioning/script/py.py", line 145, in run
  2013-10-27 01:47:17.835 24457 TRACE nova     script_func(engine)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/migrate_repo/versions/185_rename_unique_constraints.py", line 129, in upgrade
  2013-10-27 01:47:17.835 24457 TRACE nova     return _uc_rename(migrate_engine, upgrade=True)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/migrate_repo/versions/185_rename_unique_constraints.py", line 112, in _uc_rename
  2013-10-27 01:47:17.835 24457 TRACE nova     old_name, *(columns))
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/utils.py", line 197, in drop_unique_constraint
  2013-10-27 01:47:17.835 24457 TRACE nova     uc.drop()
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/migrate/changeset/constraint.py", line 59, in drop
  2013-10-27 01:47:17.835 24457 TRACE nova self.__do_imports('constraintdropper', *a, **kw)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/migrate/changeset/constraint.py", line 32, in __do_imports
  2013-10-27 01:47:17.835 24457 TRACE nova     run_single_visitor(engine, visitorcallable, self, *a, **kw)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/migrate/changeset/databases/visitor.py", line 75, in run_single_visitor
  2013-10-27 01:47:17.835 24457 TRACE nova     fn(element, **kwargs)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/migrate/changeset/ansisql.py", line 272, in visit_migrate_unique_constraint
  2013-10-27 01:47:17.835 24457 TRACE nova     self._visit_constraint(*p, **k)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/migrate/changeset/ansisql.py", line 284, in _visit_constraint
  2013-10-27 01:47:17.835 24457 TRACE nova     self.execute()
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/migrate/changeset/ansisql.py", line 42, in execute
  2013-10-27 01:47:17.835 24457 TRACE nova     return self.connection.execute(self.buffer.getvalue())
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 662, in execute
  2013-10-27 01:47:17.835 24457 TRACE nova     params)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 805, in _execute_text
  2013-10-27 01:47:17.835 24457 TRACE nova     statement, parameters
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 874, in _execute_context
  2013-10-27 01:47:17.835 24457 TRACE nova     context)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1024, in _handle_dbapi_exception
  2013-10-27 01:47:17.835 24457 TRACE nova     exc_info
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 195, in raise_from_cause
  2013-10-27 01:47:17.835 24457 TRACE nova     reraise(type(exception), exception, tb=exc_tb)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 867, in _execute_context
  2013-10-27 01:47:17.835 24457 TRACE nova     context)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 324, in do_execute
  2013-10-27 01:47:17.835 24457 TRACE nova     cursor.execute(statement, parameters)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
  2013-10-27 01:47:17.835 24457 TRACE nova     self.errorhandler(self, exc, value)
  2013-10-27 01:47:17.835 24457 TRACE nova   File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
  2013-10-27 01:47:17.835 24457 TRACE nova     raise errorclass, errorvalue
  2013-10-27 01:47:17.835 24457 TRACE nova OperationalError: (OperationalError) (1553, "Cannot drop index 'instance_uuid': needed in a foreign key constraint") 'ALTER TABLE instance_info_caches DROP INDEX instance_uuid' ()
  2013-10-27 01:47:17.835 24457 TRACE nova

  
  mysql> show create table instance_info_caches \G
  *************************** 1. row ***************************
         Table: instance_info_caches
  Create Table: CREATE TABLE `instance_info_caches` (
    `created_at` datetime DEFAULT NULL,
    `updated_at` datetime DEFAULT NULL,
    `deleted_at` datetime DEFAULT NULL,
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `network_info` mediumtext,
    `instance_uuid` varchar(36) NOT NULL,
    `deleted` int(11) DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `instance_uuid` (`instance_uuid`),
    CONSTRAINT `instance_info_caches_ibfk_1` FOREIGN KEY (`instance_uuid`) REFERENCES `instances` (`uuid`)
  ) ENGINE=InnoDB AUTO_INCREMENT=202 DEFAULT CHARSET=utf8
  1 row in set (0.00 sec) 

  
  Discussed on the OpenStack mailing list and confirmed here:

  http://lists.openstack.org/pipermail/openstack/2013-October/002414.html

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