Comment 14 for bug 1752115

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

Reviewed: https://review.openstack.org/550221
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=370c10453f95cfc42465e6f4b19d96d468b440e0
Submitter: Zuul
Branch: stable/queens

commit 370c10453f95cfc42465e6f4b19d96d468b440e0
Author: John Griffith <email address hidden>
Date: Wed Feb 28 00:56:29 2018 +0000

    Check for multiattach before removing connections

    With the addition of multiattach we need to ensure that we
    don't make brick calls to remove connections on detach volume
    if that volume is attached to another Instance on the same
    node.

    This patch adds a new helper method (_should_disconnect_target)
    to the virt driver that will inform the caller if the specified
    volume is attached multiple times to the current host.

    The general strategy for this call is to fetch a current reference
    of the specified volume and then:
    1. Check if that volume has >1 active attachments
    2. Fetch the attachments for the volume and extract the server_uuids
       for each of the attachments.
    3. Check the server_uuids against a list of all known server_uuids
       on the current host. Increment a connection_count for each item
       found.

    If the connection_count is >1 we return `False` indicating that the
    volume is being used by more than one attachment on the host and
    we therefore should NOT destroy the connection.

    *NOTE*
    This scenario is very different than the `shared_targets`
    case (for which we supply a property on the Volume object). The
    `shared_targets` scenario is specifically for Volume backends that
    present >1 Volumes using a single Target. This mechanism is meant
    to provide a signal to consumers that locking is required for the
    creation and deletion of initiator/target sessions.

    Closes-Bug: #1752115

    Change-Id: Idc5cecffa9129d600c36e332c97f01f1e5ff1f9f
    (cherry picked from commit 139426d51416313e8b14a335695adc7165bc4848)