Steps to reproduce:
1. Create an instance. $ nova boot test-1 --flavor 1 --image cirros-0.3.4-x86_64-uec
2. Create a console using api: /servers/{server_id}/consoles
3. Delete an instance $ nova delete 326757a3-66da-455f-8ffa-29775de1d5f5
4. Call db archive which raises following error $ nova-manage db archive_deleted_rows 1000
2016-06-15 14:23:27.837 WARNING nova.db.sqlalchemy.api [-] IntegrityError detected when archiving table instances: (pymysql.err.IntegrityError) (1451, u'Cannot delete or update a parent row: a foreign key constraint fails (`nova`.`consoles`, CONSTRAINT `consoles_instance_uuid_fkey` FOREIGN KEY (`instance_uuid`) REFERENCES `instances` (`uuid`))') [SQL: u'DELETE FROM instances WHERE instances.id in (SELECT T1.id FROM (SELECT instances.id \nFROM instances \nWHERE instances.deleted != %(deleted_1)s ORDER BY instances.id \n LIMIT %(param_1)s) as T1)'] [parameters: {u'param_1': 979, u'deleted_1': 0}]
Steps to reproduce:
1. Create an instance. 0.3.4-x86_ 64-uec
$ nova boot test-1 --flavor 1 --image cirros-
2. Create a console using api: /servers/ {server_ id}/consoles
3. Delete an instance 66da-455f- 8ffa-29775de1d5 f5
$ nova delete 326757a3-
4. Call db archive which raises following error deleted_ rows 1000
$ nova-manage db archive_
2016-06-15 14:23:27.837 WARNING nova.db. sqlalchemy. api [-] IntegrityError detected when archiving table instances: (pymysql. err.IntegrityEr ror) (1451, u'Cannot delete or update a parent row: a foreign key constraint fails (`nova`.`consoles`, CONSTRAINT `consoles_ instance_ uuid_fkey` FOREIGN KEY (`instance_uuid`) REFERENCES `instances` (`uuid`))') [SQL: u'DELETE FROM instances WHERE instances.id in (SELECT T1.id FROM (SELECT instances.id \nFROM instances \nWHERE instances.deleted != %(deleted_1)s ORDER BY instances.id \n LIMIT %(param_1)s) as T1)'] [parameters: {u'param_1': 979, u'deleted_1': 0}]