nova/nova/tests/unit/db
Matt Riedemann 8b007266f4 Restore soft-deleted compute node with same uuid
There is a unique index on the compute_nodes.uuid column which
means we can't have more than one compute_nodes record in the
same DB with the same UUID even if one is soft deleted because
the deleted column is not part of that unique index constraint.

This is a problem with ironic nodes where the node is 1:1 with
the compute node record, and when a node is undergoing maintenance
the driver doesn't return it from get_available_nodes() so the
ComputeManager.update_available_resource periodic task (soft)
deletes the compute node record, but when the node is no longer
under maintenance in ironic and the driver reports it, the
ResourceTracker._init_compute_node code will fail to create the
ComputeNode record again because of the duplicate uuid.

This change handles the DBDuplicateEntry error in compute_node_create
by finding the soft-deleted compute node with the same uuid and
simply updating it to no longer be (soft) deleted.

Closes-Bug: #1839560

Change-Id: Iafba419fe86446ffe636721f523fb619f8f787b3
2019-08-12 14:39:16 -04:00
..
__init__.py move all tests to nova/tests/unit 2014-11-12 15:31:08 -05:00
fakes.py hacking: Resolve W503 (line break occurred before a binary operator) 2019-06-24 14:24:06 -05:00
test_db_api.py Restore soft-deleted compute node with same uuid 2019-08-12 14:39:16 -04:00
test_migration_utils.py Use oslo_db.sqlalchemy.test_fixtures 2018-12-25 02:39:48 +00:00
test_migrations.py db: Add vpmems to instance_extra 2019-07-09 15:36:49 +08:00
test_models.py Test that new tables don't use soft deletes 2016-02-04 09:21:31 -05:00
test_sqlalchemy_migration.py Use uuidsentinel from oslo.utils 2018-09-05 09:08:54 -05:00