Grizzly -> Havana nova upgrade failure: Cannot drop index 'instance_uuid'
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Undecided
|
Joshua Hesketh | ||
Havana |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
I was running Ubuntu 13.04 and upgraded to 13.10. I was running the Ubuntu Precise 1:2013.
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.
2013-10-27 01:47:03.673 24457 INFO migrate.
...
...
2013-10-27 01:47:16.373 24457 INFO migrate.
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_
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/
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/
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/
2013-10-27 01:47:17.835 24457 TRACE nova return migration.
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
2013-10-27 01:47:17.835 24457 TRACE nova return IMPL.db_
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
2013-10-27 01:47:17.835 24457 TRACE nova return versioning_
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
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/
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/
2013-10-27 01:47:17.835 24457 TRACE nova schema.
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
2013-10-27 01:47:17.835 24457 TRACE nova change.
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
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/
2013-10-27 01:47:17.835 24457 TRACE nova return _uc_rename(
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
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/
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/
2013-10-27 01:47:17.835 24457 TRACE nova self.__
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
2013-10-27 01:47:17.835 24457 TRACE nova run_single_
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
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/
2013-10-27 01:47:17.835 24457 TRACE nova self._visit_
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
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/
2013-10-27 01:47:17.835 24457 TRACE nova return self.connection
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
2013-10-27 01:47:17.835 24457 TRACE nova params)
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
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/
2013-10-27 01:47:17.835 24457 TRACE nova context)
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
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/
2013-10-27 01:47:17.835 24457 TRACE nova reraise(
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
2013-10-27 01:47:17.835 24457 TRACE nova context)
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
2013-10-27 01:47:17.835 24457 TRACE nova cursor.
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
2013-10-27 01:47:17.835 24457 TRACE nova self.errorhandl
2013-10-27 01:47:17.835 24457 TRACE nova File "/usr/lib/
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_
2013-10-27 01:47:17.835 24457 TRACE nova
mysql> show create table instance_
*******
Table: instance_
Create Table: CREATE TABLE `instance_
`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_
) 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://
Changed in nova: | |
status: | New → Incomplete |
status: | Incomplete → Confirmed |
Changed in nova: | |
assignee: | nobody → Joshua Hesketh (joshua.hesketh) |
Changed in nova: | |
status: | Confirmed → In Progress |
Changed in nova: | |
milestone: | none → icehouse-1 |
Changed in nova: | |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | icehouse-1 → 2014.1 |
This is odd, but known behavior of MySQL: it doesn't allow one to drop a unique constraint if one or more columns of the latter are used a FK. So the solution is to drop the FK first, drop the unique and then recreate the FK. And this is what migration 185 does.
The problem with this particular migration is that your FK name doesn't correspond the one we have in the original Folsom migration (133_folsom.py): instance_ info_caches_ ibfk_1 vs instance_ info_caches_ instance_ uuid_fkey. The name instance_ info_caches_ ibfk_1 comes from the Essex initial migration (082_essex.py).
Did you upgrade this installation from Folsom to Grizzly before?
From what I see, we have a bug in migration 133_folsom.py, which accidentally changed the name of the FK constraint when all pre-folsom migrations were compacted.