add delete_on_termination option for attaching volume to an existing server

Registered by Lee Li on 2013-12-09

There is the delete_on_termination option for attaching volume when creating a server but not for an existing server. So when delete the server may be two cases although the delete_on_termination option is true, one the attached volume can be deleted, the other is not.

Attach a volume when creating a server, the API contains 'block_device_mapping', such as:
"block_device_mapping": [
            {
                "volume_id": "<VOLUME_ID>",
                "device_name": "/dev/vdc",
                "delete_on_termination": "true"
            }
]

It can contain 'delete_on_termination' option.

Attach a volume to existing server, there is no option 'delete_on_termination', the POST data likes:
{
    "volumeAttachment":{
    "volumeId":"<VOLUME_ID>",
    "device":"/dev/sdb"
    }
}

Blueprint information

Status:
Started
Approver:
None
Priority:
Undefined
Drafter:
Xurong Yang
Direction:
Needs approval
Assignee:
Xurong Yang
Definition:
Review
Series goal:
None
Implementation:
Needs Code Review
Milestone target:
None
Started by
Lee Li on 2014-01-17

Related branches

Sprints

Whiteboard

Please set the milestone target for this blueprint. Also this blueprint should only cover the Nova work (we can include the novaclient work in this I feel) but please create a separate blueprint for the dashboard work --johnthetubaguy

Hi ALL,
This is my investigation about this blueprint.
In the current Openstack logic, the process flow are:
a) The delete_on_termination option is allowed in attach_volume api;
b) In function _attach_volume of nova/compute/manager.py, the value delete_on_termination should be set by context from api;
c) The client command 'nova volume-attach' should add the option delete_on_termination.

I've finished the two patch continue the nova and novaclient.
please share with your opinion :)

Gerrit topic: https://review.openstack.org/#q,topic:bp/aimed,n,z

Addressed by: https://review.openstack.org/67067
    Add delete_on_termination option for attaching volume

Addressed by: https://review.openstack.org/#/c/67074/
    Add delete_on_termination option to NovaClient

Removed from next, as next is now reserved for near misses from the last milestone --johnthetubaguyPlease set the milestone target for this blueprint. Also this blueprint should only cover the Nova work (we can include the novaclient work in this I feel) but please create a separate blueprint for the dashboard work --johnthetubaguy

If you are still working on this, please re-submit via nova-specs. If not, please mark as obsolete, and add a quick comment to describe why. --johnthetubaguy (20th April 2014)

Gerrit topic: https://review.openstack.org/#q,topic:bp/add-delete-on-termination-option,n,z

Addressed by: https://review.openstack.org/89777
    nova-specs for "add-delete-on-termination-option"

Spec not approved yet, un-targeting blueprint from juno-1 --johnthetubaguy (28th May 2014)

(?)

Work Items

Work items:
Nova: DONE
NovaClient: DONE

This blueprint contains Public information 
Everyone can see this information.