Comment 13 for bug 1762687

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

Reviewed: https://review.openstack.org/560074
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=dd93b0c7190681620c3eed9937462901da42c7c4
Submitter: Zuul
Branch: master

commit dd93b0c7190681620c3eed9937462901da42c7c4
Author: Matt Riedemann <email address hidden>
Date: Tue Apr 10 12:28:05 2018 -0400

    Refresh volume when checking for conflicting attachments

    We should only be able to create more than one attachment to the
    same volume if it's (1) multiattach=True or (2) it's multiattach=False
    AND the attachments are to the same instance. It is not valid to
    attach more than one instance to the same multiattach=False volume.

    The _attachment_reserve method is checking for this if the
    conditional update to the volume status fails, but it does
    not refresh the volume before checking the attachments. Since
    we could be racing to create attachments concurrently, when
    the request that failed the conditional update actually pulled
    the volume out of the DB, it might not have had any attachments,
    so we need to refresh it before checking the list of attachments
    to see if the instance we're trying to attach (reserve the volume)
    is the same as what's already attached to the volume.

    Change-Id: Iee78555163bbcbb5ff3e0ba008d7c87a3aedfb0f
    Closes-Bug: #1762687