Comment 3 for bug 1594584

Revision history for this message
Jimmy McCrory (jimmy-mccrory) wrote :

On two environments upgrading from Kilo to Liberty, I've seen the case where `nova-manage db migrate_flavor_data` says "0 instances matched query", but the db migration to validate in Liberty fails.

This is the query run in Liberty to ensure that the flavor migration has already happened in Kilo:

SELECT COUNT(*) FROM nova.instance_system_metadata sysmeta, nova.instances inst
WHERE inst.uuid = sysmeta.instance_uuid
AND sysmeta.key = 'instance_type_id'
AND sysmeta.deleted != sysmeta.id
AND inst.deleted != inst.id;

https://github.com/openstack/nova/blob/stable/liberty/nova/db/sqlalchemy/migrate_repo/versions/291_enforce_flavors_migrated.py#L24-L28

Haven't been able to track down exactly what's causing this, maybe a VM delete that didn't completely propagate everything it needed to.
Fixed by setting nova.instance_system_metadata.deleted to the same value as nova.instances.id.