commit 648770bd6897aa2ec95df3ec55344d5803543f07
Author: Matt Riedemann <email address hidden>
Date: Fri Aug 9 17:17:45 2019 -0400
rt: only map compute node if we created it
If ComputeNode.create() fails, the update_available_resource
periodic will not try to create it again because it will be
mapped in the compute_nodes dict and _init_compute_node will
return early but trying to save changes to that ComputeNode
object later will fail because there is no id on the object,
since we failed to create it in the DB.
This simply reverses the logic such that we only map the
compute node if we successfully created it.
Some existing _init_compute_node testing had to be changed
since it relied on the order of when the ComputeNode object
is created and put into the compute_nodes dict in order
to pass the object along to some much lower-level PCI
tracker code, which was arguably mocking too deep for a unit
test. That is changed to avoid the low-level mocking and
assertions and just assert that _setup_pci_tracker is called
as expected.
Change-Id: I9fa1d509a3de405d6246fb8670612c65c10cc93b
Closes-Bug: #1839674
(cherry picked from commit f578146f372386e1889561cba33e95495e66ce97)
Reviewed: https:/ /review. opendev. org/676278 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=648770bd689 7aa2ec95df3ec55 344d5803543f07
Committed: https:/
Submitter: Zuul
Branch: stable/stein
commit 648770bd6897aa2 ec95df3ec55344d 5803543f07
Author: Matt Riedemann <email address hidden>
Date: Fri Aug 9 17:17:45 2019 -0400
rt: only map compute node if we created it
If ComputeNode. create( ) fails, the update_ available_ resource
periodic will not try to create it again because it will be
mapped in the compute_nodes dict and _init_compute_node will
return early but trying to save changes to that ComputeNode
object later will fail because there is no id on the object,
since we failed to create it in the DB.
This simply reverses the logic such that we only map the
compute node if we successfully created it.
Some existing _init_compute_node testing had to be changed
since it relied on the order of when the ComputeNode object
is created and put into the compute_nodes dict in order
to pass the object along to some much lower-level PCI
tracker code, which was arguably mocking too deep for a unit
test. That is changed to avoid the low-level mocking and
assertions and just assert that _setup_pci_tracker is called
as expected.
Change-Id: I9fa1d509a3de40 5d6246fb8670612 c65c10cc93b 1889561cba33e95 495e66ce97)
Closes-Bug: #1839674
(cherry picked from commit f578146f372386e