Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly clean up BDMs when _provision_instances fails
_provision_instances calls create_db_entry_for_new_instance which creates the instance and block device mappings in the database. The instance is added to the instances list which is used in the global exception block at the bottom of _provision_instances to destroy any instances created. A failure that can trigger this cleanup attempt after the instance and BDMs are created is when checking server group member count fails with OverQuota. The problem is that we fail to (soft) delete the block device mappings that we created. Since there is a foreign key constraint between the block_device_mapping and instances tables in the database, when we try to archive (copy soft deleted things to shadow tables and then hard-delete them) the deleted instance it will fail on a referential constraint error due to the BDM(s) which weren't deleted. We can fix this by deleting the BDMs when deleting the instance just like we do for other reference tables. A functional test is added to demonstrate the failure and fix which also has the nice benefit of functionally testing the server group member overquota error handling. Change-Id: Ida66a93031046bafcf30c95ca232fb6382c2597b Closes-Bug: #1569641
- Loading branch information
Matt Riedemann
committed
Apr 15, 2016
1 parent
6ae2b45
commit 5674e76
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters