Comment 14 for bug 1839674

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/pike)

Reviewed: https://review.opendev.org/676463
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=b576461cd96c6bf707e77a2bd43fda3e486cc9e5
Submitter: Zuul
Branch: stable/pike

commit b576461cd96c6bf707e77a2bd43fda3e486cc9e5
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/tests/unit/compute/test_resource_tracker.py

    NOTE(mriedem): The conflict and slight change to test
    test_compute_node_create_fail_retry_works is because
    I120a98cc4c11772f24099081ef3ac44a50daf71d is not in Pike.

    Change-Id: I9fa1d509a3de405d6246fb8670612c65c10cc93b
    Closes-Bug: #1839674
    (cherry picked from commit f578146f372386e1889561cba33e95495e66ce97)
    (cherry picked from commit 648770bd6897aa2ec95df3ec55344d5803543f07)
    (cherry picked from commit 35273a844ab2dc2494f0166d9b8228ee302acd4f)
    (cherry picked from commit 5a3430983ab37aaed6bfc7ead0eb14121ffe69d3)