commit 8b007266f438ec0a5a797d05731cce6f2b155f4c
Author: Matt Riedemann <email address hidden>
Date: Mon Aug 12 14:39:16 2019 -0400
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.
Reviewed: https:/ /review. opendev. org/675496 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=8b007266f43 8ec0a5a797d0573 1cce6f2b155f4c
Committed: https:/
Submitter: Zuul
Branch: master
commit 8b007266f438ec0 a5a797d05731cce 6f2b155f4c
Author: Matt Riedemann <email address hidden>
Date: Mon Aug 12 14:39:16 2019 -0400
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 nodes() so the ger.update_ available_ resource periodic task (soft) cker._init_ compute_ node code will fail to create the
the compute node record, and when a node is undergoing maintenance
the driver doesn't return it from get_available_
ComputeMana
deletes the compute node record, but when the node is no longer
under maintenance in ironic and the driver reports it, the
ResourceTra
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: Iafba419fe86446 ffe636721f523fb 619f8f787b3