V3 attachment_update sets volume to "in-use", should be "attaching"

Bug #1710295 reported by John Griffith
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Critical
John Griffith

Bug Description

The new attachment_update method in Cinder's API creates an attachment object and populates it with the provided connector info. In addition, we set the volumes status to in-use and update the attachment object status to "attached".

This isn't really accurate though, because we don't know if the volume is actually attached (connected) by the consumer or not. We make that assumption which might be ok, particular for consumers outside of OpenStack that keep their own records of things.

In a traditional nova/openstack context however this creates some significant problems. Primarily the standard for testing and knowing if a volume is in-use or not is the volume-status flag and it indicates that the volume has been acknowledged as succesfully connected/attached to an Instance. By setting this to in-use on the attachment_update call we introduce a pretty bad race:
1. attachment_update
        - volume status goes to in-use
        - nova issues call to os-brick to perform connection and attach to instance
2. Tempest test is polling looking for volume-status "in-use" to determine if/when done
        - Tempest sees the "in-use" status, considers the process complete, test good and issues
          a detach

It turns out that the detach can easily end up being called while brick is still working on
connecting the volume. When this happens, we then try and do a disconnect, brick doesn't see
the device and moves along. But then we end up with an orphaned device file on the compute node.

Another big draw back here in terms of the tests is that it's possible for every single brick connection to fail, but for all of the tests to be marked as "passed". This is a pretty serious bug.

Changed in cinder:
status: New → In Progress
importance: Undecided → Critical
assignee: nobody → John Griffith (john-griffith)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/493262

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

Reviewed: https://review.openstack.org/493262
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=7f69969345ec027595d2530d646cc5fd820be65a
Submitter: Jenkins
Branch: master

commit 7f69969345ec027595d2530d646cc5fd820be65a
Author: John Griffith <email address hidden>
Date: Fri Aug 11 17:19:06 2017 -0600

    Make attachment_update set status to attaching

    The new attachment_update method in Cinder's API creates an attachment
    object and populates it with the provided connector info. In addition,
    we set the volumes status to in-use and update the attachment object
    status to "attached".

    This isn't really accurate though, because we don't know if the volume
    is actually attached (connected) by the consumer or not. Also a big
    side effect here is that currently all of our tests and automation
    use volume-status to determine if a volume is fully connected/ready
    for use and that everything went well. It's used as an ack in most
    cases.

    This change goes back to using multiple states to signify where a
    an attachment is in it's life-cycle:
    1. reserved
         We've created an empty attachment record but haven't done anything
         with it yet.
    2. attaching
         We provided a connector and set up the TGT so that everything is
         ready for a consumer to connect/use it.
    3. in-use
         An ACK back from the consumer letting us know that they connected
         it successfully and are doing their thing.

    Some consumers don't need or care about this last step, and we're going
    to provide a means to set it straight to attached/in-use, but for
    this bug we don't need to introduce that particular *feature*.

    Sadly, this requires a micro-version bump and a new API call to
    toggle the state from the API, pushing us to 3.44.

    closes-bug #1710295

    Change-Id: I57631d3deddb2d7cd244584e82206ee17fe2dd78

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/493832

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

Reviewed: https://review.openstack.org/493832
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=7e2b3dbc85683e1ce512351aca8c3fac10cc79fe
Submitter: Jenkins
Branch: master

commit 7e2b3dbc85683e1ce512351aca8c3fac10cc79fe
Author: Ildiko Vancsa <email address hidden>
Date: Tue Aug 15 12:49:28 2017 +0200

    Save object after updating for attachment_complete

    Closes-Bug #1710295

    Change-Id: Ibb4ac9f6eed448a6a13bd63312231910008c0737

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.