commit 35273a844ab2dc2494f0166d9b8228ee302acd4f
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.
NOTE(mriedem): The resource_tracker.py conflict is due to
not having I14a310b20bd9892e7b34464e6baad49bf5928ece in Rocky.
The test conflicts are due to not having change
I37e8ad5b14262d801702411c2c87e73550adda70 in Rocky.
Change-Id: I9fa1d509a3de405d6246fb8670612c65c10cc93b
Closes-Bug: #1839674
(cherry picked from commit f578146f372386e1889561cba33e95495e66ce97)
(cherry picked from commit 648770bd6897aa2ec95df3ec55344d5803543f07)
Reviewed: https:/ /review. opendev. org/676280 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=35273a844ab 2dc2494f0166d9b 8228ee302acd4f
Committed: https:/
Submitter: Zuul
Branch: stable/rocky
commit 35273a844ab2dc2 494f0166d9b8228 ee302acd4f
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.
Conflicts:
nova/ compute/ resource_ tracker. py
nova/ tests/unit/ compute/ test_resource_ tracker. py
NOTE(mriedem): The resource_tracker.py conflict is due to 2e7b34464e6baad 49bf5928ece in Rocky. 262d801702411c2 c87e73550adda70 in Rocky.
not having I14a310b20bd989
The test conflicts are due to not having change
I37e8ad5b14
Change-Id: I9fa1d509a3de40 5d6246fb8670612 c65c10cc93b 1889561cba33e95 495e66ce97) ec95df3ec55344d 5803543f07)
Closes-Bug: #1839674
(cherry picked from commit f578146f372386e
(cherry picked from commit 648770bd6897aa2