Reviewed: https://review.opendev.org/661398 Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=0b92c7e741b5abb1df70cc1d3bb8f0d1989cf2f5 Submitter: Zuul Branch: master
commit 0b92c7e741b5abb1df70cc1d3bb8f0d1989cf2f5 Author: Matt Riedemann <[email protected]> Date: Fri May 24 17:08:20 2019 -0400 Fix hard-delete of instance with soft-deleted referential constraints When hard-deleting an instance we first delete related records but the code was not taking into account soft-deleted related records which will result in the instance delete failing due to a referential constraint because soft-deleted records are not really deleted when it comes to table constraints. This fixes the issue by simply passing read_deleted='yes' to the related record model query in the hard delete path. The related unit test is updated to cover this scenario and a typo in that same test is also fixed here. Change-Id: I9fc5a9cc40ceffc450c1fde1df7fb36581e9cc94 Closes-Bug: #1830438 ** Changed in: nova Status: In Progress => 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/1830438 Title: Hard deleting instance does not take into account soft-deleted referential constraints Status in OpenStack Compute (nova): Fix Released Bug description: The instance hard delete code is new in Train but has a bug noted here: https://review.opendev.org/#/c/570202/8/nova/db/sqlalchemy/api.py@1804 The hard delete of the instance can fail if there are related soft- deleted records (like detached volumes [bdms]), because I hit this in a gate run of the cross-cell resize stuff: http://paste.openstack.org/show/752057/ 'Cannot delete or update a parent row: a foreign key constraint fails (`nova_cell2`.`block_device_mapping`, CONSTRAINT `block_device_mapping_instance_uuid_fkey` FOREIGN KEY (`instance_uuid`) REFERENCES `instances` (`uuid`))') [SQL: 'DELETE FROM instances WHERE instances.uuid = %(uuid_1)s'] [parameters: {'uuid_1': '4b8a12c4-e28a-49cc-a681-236c1e8a174c'}] To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1830438/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

