Comment 4 for bug 1549984

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

Reviewed: https://review.openstack.org/291847
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=66e79e1bbca66a6f0f7be14006a87426c4dda402
Submitter: Jenkins
Branch: master

commit 66e79e1bbca66a6f0f7be14006a87426c4dda402
Author: Jay Pipes <email address hidden>
Date: Fri Mar 11 13:16:40 2016 -0500

    pci - Claim devices outside of Claim constructor

    During the nova.compute.Claim.__init__() call, there are a bunch of
    _test_XXX() methods that are called. These methods should test to see
    whether the requested resources of various types can be satisfied by the
    inventory on the ComputeNode. However, that inventory *should not* be
    claimed for a particular request during the Claim object's constructor.

    The Claim._test_pci() method was *actually* claiming the PCI device for
    the requested instance. Unfortunately, this meant that if an instance
    launch request's demand for a resource like RAM was not able to be
    satisfied by the compute node but the launch request's demand for PCI
    devices *was* able to be satisfied by the compute node, those PCI
    devices were actually claimed for the instance even though the claim
    itself would end up being aborted. This resulted in a data
    corruption/inconsistency where a PCI device would be claimed for an
    instance that actually was not running on the node.

    This patch moves the claim of PCI devices out of the _test_pci() method
    and into the ResourceTracker.instance_claim() method. In the process of
    fixing this bug, it was discovered that the unit tests for the Claim
    object with regards to PCI devices were just plain broken. They were
    testing for nothing at all because of the way the Claim constructor
    works. These unit tests were reworked completely, along with the
    MoveClaim unit tests which similarly were not testing the PCI code paths
    at all. An additional unit test was added on the resource tracker to
    verify that nova.pci.manager.PciDevTracker.claim_instance() is called
    when PCI requests are included and satisfied by the Claim.

    Change-Id: Icf75439a552de84ec31c1a47faeee3caf8a5b0a7
    Closes-bug: #1549984