Comment 2 for bug 1892870

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

Reviewed: https://review.opendev.org/747957
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=39831c55999abe97e3bd26a1c0db2e4ceb467041
Submitter: Zuul
Branch: master

commit 39831c55999abe97e3bd26a1c0db2e4ceb467041
Author: Alexandre Arents <email address hidden>
Date: Mon Aug 24 14:05:27 2020 +0000

    Add a lock to prevent race during detach/attach of interface

    Only allow one detach/attach at a time with the same pattern instance-port_id
    in order to avoid race condition when multiple detach/attach are run
    concurrently.

    When multiple detach run concurrently on a specific instance-port_id,
    manager consider many of them as valid because info_cache still contains
    the port and info_cache is refreshed only once the first request complete.

    So during this gap of time, while the first request accomplishes the task,
    all subsequent requests are destined to fail and log a warning [1] in
    different location of code, depending on the outcome of the first request.
    The Issue is that all those caught requests finally run a
    deallocate_port_for_instance which will unbind the port.

    This may cause a race condition, because a successful attach can pass between
    those unbind, and be silently unbound, resulting in an infrastructure/DB
    inconsistency.

    [1] 'Detaching interface %(mac)s failed because the device is no longer found
         on the guest.'

    Closes-Bug: #1892870
    Change-Id: Iea5969d0bd16dc9a6f1ba950224b0115e466ce66