cinder migrate-completion can't work with new attach api's

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

Bug Description

migrate_volume_completion is some crazy stuff, the process looks kinda like this:
1. Issue a retype with migration allowed on an in-use volume

2. Cinder creates a new volume of the requested different type (as long as it is in fact a different type)

3. Call Nova's volume-update to the server the current in-use volume is attached to specifying the original volume and the newly created volume

4. Nova Attaches the new volume to the instance, uses libvrity/Kvm copy api to copy the data from src->destinstation

5. Terminate the connection for the source volume

6. Issue completion callback to Cinder where Cinder will go through and do some tricks with ID swapping and status changes.

So this works sometimes and that's great, BUT with the V2 Attach API's in Cinder we closed the backdoor to allowing callers to create attachments/connections without actually setting attachment status. In other words, there are all sorts of things that Nova does today that is actually multi-attach, but in the past we have always sort of pretended it wasn't happening. The new attach API's don't let you do this. If you create a connection or get connection info, you always get an attachemnt record. This means the final steps in the migration completion where it swaps the volume-ids and issues an attach to update the status from retyping to in-use doesn't work any more because it has a "if multi-attach not enabled: fail". So, remove that check.

At some point the migration-completion really needs a full make over.

Changed in cinder:
importance: Undecided → High
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/472786

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

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

commit d79b9224d85fd23557281c7f35204cdeac67ef23
Author: John Griffith <email address hidden>
Date: Fri Jun 9 13:31:28 2017 -0600

    Fix migration completion for New Attach API's

    The old attach workflow let us do things that we probably shouldn't,
    like attaching a volume without actually going through Cinder and
    running the attach cmd to set the status.

    With the new Attach API we try and avoid a lot of the little special
    things by having everything go through an attachment object. A
    challenge with this is the retype or migration of an in-use volume.
    The old flow was to attach the new volume but not mark it as
    attached until the migration completion callback. The new API's
    discourage this and set the volume to attached.. well, when you
    attach it.

    The cleanest way to deal with this right now is first to actually
    check on the nova side if the swap was initiated by Cinder or not,
    and always (when using new attach API) have Nova delete the original
    attachment after the swap/copy.

    On the cinder side in that case we only need to update the attachment
    object, so remember attachment-2 (destination) is a new volume but we
    go through the volume entry in the db and swap it's ID with the original
    volume-id, so we need to do a similar swap in the attachment table.

    This keeps the secondary attachment record which is valid, and just does
    the crazy swappy magic of the volume_id entry. This also maintains
    backward compatability for the old Attach/Detach flow.

    Change-Id: I23391300468cc5e2f45a12d5ad8617ab48c21e6a
    Closes-Bug: #1697060

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 11.0.0.0b3

This issue was fixed in the openstack/cinder 11.0.0.0b3 development milestone.

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.