Comment 5 for bug 1732316

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

Reviewed: https://review.openstack.org/519943
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=b9c26ad1717de62b3dc7b5211145091eb21e9b17
Submitter: Zuul
Branch: stable/ocata

commit b9c26ad1717de62b3dc7b5211145091eb21e9b17
Author: Matt Riedemann <email address hidden>
Date: Thu Oct 19 14:36:29 2017 -0400

    Don't update RT in _allocate_network

    The call to _update_resource_tracker from
    _allocate_network is a carryover from old
    times when _allocate_network would call
    _instance_update which would update the
    resource tracker generically for any state
    change in an instance.

    _update_resource_tracker calls rt.update_usage
    which grabs the COMPUTE_RESOURCE_SEMAPHORE lock
    which is the same lock used during claims and when
    the update_available_resource periodic task runs.

    The update_usage method can be a bit heavy weight
    if you're not actually changing anything the
    resource tracker cares about, because it's re-calculating
    stats for the capabilities scheduler filter and it's
    collecting new inventory from the virt driver and
    potentially updating that inventory for the compute
    node in placement.

    So given all _allocate_network is doing is changing
    the state on the instance, and the state it's changing
    to has nothing to do with what the resource tracker
    cares about (like deleting or shelve offloading an instance),
    we shouldn't call rt.update_usage and hold that big
    lock unnecessarily since it could hold up other
    operations happening at the same time, like creating
    instances.

    Closes-Bug: #1732316

    Change-Id: Ib588c31a4d2075f8730409d50c99dfb04180a9cd
    (cherry picked from commit 7b0d5f7f347cb1c040595000d9d6987369dce2ab)