commit 5a3430983ab37aaed6bfc7ead0eb14121ffe69d3
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 tests need to be modified slightly since
Ia69fabce8e7fd7de101e291fe133c6f5f5f7056a is not in Queens
so _copy_resources is wrapped to set ComputeNode.uuid.
Change-Id: I9fa1d509a3de405d6246fb8670612c65c10cc93b
Closes-Bug: #1839674
(cherry picked from commit f578146f372386e1889561cba33e95495e66ce97)
(cherry picked from commit 648770bd6897aa2ec95df3ec55344d5803543f07)
(cherry picked from commit 35273a844ab2dc2494f0166d9b8228ee302acd4f)
Reviewed: https:/ /review. opendev. org/676285 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=5a3430983ab 37aaed6bfc7ead0 eb14121ffe69d3
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit 5a3430983ab37aa ed6bfc7ead0eb14 121ffe69d3
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 tests need to be modified slightly since 7fd7de101e291fe 133c6f5f5f7056a is not in Queens
Ia69fabce8e
so _copy_resources is wrapped to set ComputeNode.uuid.
Change-Id: I9fa1d509a3de40 5d6246fb8670612 c65c10cc93b 1889561cba33e95 495e66ce97) ec95df3ec55344d 5803543f07) 494f0166d9b8228 ee302acd4f)
Closes-Bug: #1839674
(cherry picked from commit f578146f372386e
(cherry picked from commit 648770bd6897aa2
(cherry picked from commit 35273a844ab2dc2