# Pastebin VDQ4tpyv Token curl -d '{"auth":{"tenantName": "admin", "passwordCredentials":{"username": "admin", "password": "abc1234"}}}' -H "Content-type: application/json" http://10.0.2.15:35357/v2.0/tokens Volume list has bug for bootable status https://bugs.launchpad.net/openstack-manuals/+bug/1536845 Volume 1. GET A. List volumes /v2/?{tenant_id}?/volumes curl -H "X-Auth-Token:gAAAAABXOAsmCySO3CaJSYVFl6VEaOD43wrCf7p577rt3wV2tF7wEVwPRFThd2kXR69tiYjLwi2fPj3HwVW6Q84t958oVW7FPybr4vlw9UfL2Bigy07X1j3HxDVVgmpcGuVq6u8ETHDAG_2x1r2_QnJ6tiffQ6XTgvRMLhNpHlML7t5Fq_BQ8lk" http://10.0.2.15:8776/v2/7b68039c470b4c9bbd02c375df9b9bfd/volumes -X GET {"volumes": [{"id": "bfddea85-030f-4307-b55d-65a419043d69", "links": [{"href": "http://10.0.2.15:8776/v2/7b68039c470b4c9bbd02c375df9b9bfd/volumes/bfddea85-030f-4307-b55d-65a419043d69", "rel": "self"}, {"href": "http://10.0.2.15:8776/7b68039c470b4c9bbd02c375df9b9bfd/volumes/bfddea85-030f-4307-b55d-65a419043d69", "rel": "bookmark"}], "name": "sheel"}]} status: 200 ------------------------------------------------------------------------------------------------------------ Everything ok, just need to update 1. yaml file for below response parameters: id body string The UUID of the volume transfer. links body array Links for the volume transfer. name body string The name of the volume transfer. 2. Only keep normal response code: 200 3. update input parameters to Lists all volumes. Optional arguments: --all-tenants [<0|1>] Shows details for all tenants. Admin only. --name Filters results by a name. Default=None. --status Filters results by a status. Default=None. --bootable [] Filters results by bootable status. Default=None. --migration_status Filters results by a migration status. Default=None. Admin only. --metadata [ [ ...]] Filters results by a metadata key and value pair. Default=None. --marker Begin returning volumes that appear later in the volume list than that represented by this volume id. Default=None. --limit Maximum number of volumes to return. Default=None. --fields Comma-separated list of fields to display. Use the show command to see which fields are available. Unavailable/non-existent fields will be ignored. Default=None. --sort [:] Comma-separated list of sort keys and directions in the form of [:]. Valid keys: id, status, size, availability_zone, name, bootable, created_at. Default=None. --tenant [] Display information from single tenant (Admin only). ------------------------------------------------------------------------------------------------------------ B. List volumes with details /v2/?{tenant_id}?/volumes/detail curl -H "X-Auth-Token:gAAAAABXOAsmCySO3CaJSYVFl6VEaOD43wrCf7p577rt3wV2tF7wEVwPRFThd2kXR69tiYjLwi2fPj3HwVW6Q84t958oVW7FPybr4vlw9UfL2Bigy07X1j3HxDVVgmpcGuVq6u8ETHDAG_2x1r2_QnJ6tiffQ6XTgvRMLhNpHlML7t5Fq_BQ8lk" http://10.0.2.15:8776/v2/7b68039c470b4c9bbd02c375df9b9bfd/volumes/detail -X GET {"volumes": [{"migration_status": null, "attachments": [], "links": [{"href": "http://10.0.2.15:8776/v2/7b68039c470b4c9bbd02c375df9b9bfd/volumes/bfddea85-030f-4307-b55d-65a419043d69", "rel": "self"}, {"href": "http://10.0.2.15:8776/7b68039c470b4c9bbd02c375df9b9bfd/volumes/bfddea85-030f-4307-b55d-65a419043d69", "rel": "bookmark"}], "availability_zone": "nova", "os-vol-host-attr:host": "sheel-VirtualBox@lvmdriver-1#lvmdriver-1", "encrypted": false, "updated_at": "2016-05-15T06:04:30.000000", "replication_status": "disabled", "snapshot_id": null, "id": "bfddea85-030f-4307-b55d-65a419043d69", "size": 1, "user_id": "be75942374fb4e5891555dc3220a764d", "os-vol-tenant-attr:tenant_id": "7b68039c470b4c9bbd02c375df9b9bfd", "os-vol-mig-status-attr:migstat": null, "metadata": {}, "status": "available", "description": null, "multiattach": false, "source_volid": null, "consistencygroup_id": null, "os-vol-mig-status-attr:name_id": null, "name": "sheel", "bootable": "false", "created_at": "2016-05-15T06:04:24.000000", "volume_type": "lvmdriver-1"}]} ------------------------------------------------------------------------------------------------------------ Everything ok, just need to update 1. yaml file for below response parameters: Same as volume list 2. Only keep normal response code: 200 -------------------------------------------------------------------------------------------------------------- C. Show volume details /v2/?{tenant_id}?/volumes/?{volume_id}? Request Parameters: curl -H "X-Auth-Token:gAAAAABXOBsPKw7SrcQvroC-DCmpVByT37zSyWnhMGkf7_oajD1qxL2RCcyN-zeFqBHJbkoHmwmn8sAgC6qmqtU_T3lq5Fqzwa-f9OMWi_M9z946lnrP5VCcdAs1NjvYyfkrhojCYoQ-oqt-i_SnQ3-uDUykbZrfMkOpD0jmUzeKd2Nd8vopmjQ" -H "Content-type: application/json" http://10.0.2.15:8776//v2/7b68039c470b4c9bbd02c375df9b9bfd/volumes/f9255b66-edcc-4aee-81e0-9f7ee2a9342b -X GET Response parameters: cinder show Shows volume details. Positional arguments: Name or ID of volume. {"volume": {"migration_status": null, "attachments": [], "links": [{"href": "http://10.0.2.15:8776/v2/7b68039c470b4c9bbd02c375df9b9bfd/volumes/f9255b66-edcc-4aee-81e0-9f7ee2a9342b", "rel": "self"}, {"href": "http://10.0.2.15:8776/7b68039c470b4c9bbd02c375df9b9bfd/volumes/f9255b66-edcc-4aee-81e0-9f7ee2a9342b", "rel": "bookmark"}], "availability_zone": "nova", "os-vol-host-attr:host": "sheel-VirtualBox@lvmdriver-1#lvmdriver-1", "encrypted": false, "updated_at": "2016-05-15T06:45:59.000000", "replication_status": "disabled", "snapshot_id": null, "id": "f9255b66-edcc-4aee-81e0-9f7ee2a9342b", "size": 1, "user_id": "be75942374fb4e5891555dc3220a764d", "os-vol-tenant-attr:tenant_id": "7b68039c470b4c9bbd02c375df9b9bfd", "os-vol-mig-status-attr:migstat": null, "metadata": {}, "status": "available", "description": null, "multiattach": false, "source_volid": null, "consistencygroup_id": null, "os-vol-mig-status-attr:name_id": null, "name": "sheel_2", "bootable": "false", "created_at": "2016-05-15T06:45:58.000000", "volume_type": "lvmdriver-1"}} D. Show volume metadata: /v2/{tenant_id}/volumes/{volume_id}/metadata Request: curl -H "X-Auth-Token:gAAAAABXOJgxGz4jypkdUDsSKFyf8ap70BP0EluI-fAzvTWlTwotTfiRUeL4zb5xKd1jOmuWjJKlyJCtr9OsZumAhiQuu-n-scCJ_0ASAnZfXaw_P1IxxWLork5903ABlLWhQQ9nJiF78XFQauZOq0kNSzXIQkjnUpjsTD-XNbY18q3hLceszxs" http://10.0.2.15:8776/v2/7b68039c470b4c9bbd02c375df9b9bfd/volumes/f9255b66-edcc-4aee-81e0-9f7ee2a9342b/metadata -X GET Response: {"metadata": {"xyz": "123", "abc": "123"}} cinder metadata-show Shows volume metadata. Positional arguments: ID of volume. 2. PUT A. update a volume /v2/?{tenant_id}?/volumes/?{volume_id}? curl -H "X-Auth-Token:gAAAAABXODNSOc0_JuqzwRpJmqF815CPo3VCccVUW0UWN9qvdtYOkobQNiJq2_5dLhfN0OZ4c8Kdm2d-Wm8UWL0pLGM4kRd3P4n5vjxxtLR4lO04LCedOIbT1I5IA7Xv63SclFHfehxh5TGXWDAtH7Vb8OJK6-9SueDpmDcXbb09LA_sF1tTHxQ" -H "Content-type: application/json" http://10.0.2.15:8776/v2/7b68039c470b4c9bbd02c375df9b9bfd/volumes/bfddea85-030f-4307-b55d-65a419043d69 -X PUT -d '{"volume": {"name": "test12", "description": "Renaming"}}' {"volume": {"status": "available", "migration_status": null, "user_id": "be75942374fb4e5891555dc3220a764d", "attachments": [], "links": [{"href": "http://10.0.2.15:8776/v2/7b68039c470b4c9bbd02c375df9b9bfd/volumes/bfddea85-030f-4307-b55d-65a419043d69", "rel": "self"}, {"href": "http://10.0.2.15:8776/7b68039c470b4c9bbd02c375df9b9bfd/volumes/bfddea85-030f-4307-b55d-65a419043d69", "rel": "bookmark"}], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2016-05-15T06:04:24.000000", "description": "Renaming", "updated_at": "2016-05-15T08:14:17.000000", "volume_type": "lvmdriver-1", "name": "test12", "replication_status": "disabled", "consistencygroup_id": null, "source_volid": null, "snapshot_id": null, "multiattach": false, "metadata": {}, "id": "bfddea85-030f-4307-b55d-65a419043d69", "size": 1}} Renames a volume. Positional arguments: Name or ID of volume to rename. New name for volume. Optional arguments: --description Volume description. Default=None. Status:200 B. Update volume metadata /v2/?{tenant_id}?/volumes/?{volume_id}?/metadata curl -H "X-Auth-Token:gAAAAABXOJgxGz4jypkdUDsSKFyf8ap70BP0EluI-fAzvTWlTwotTfiRUeL4zb5xKd1jOmuWjJKlyJCtr9OsZumAhiQuu-n-scCJ_0ASAnZfXaw_P1IxxWLork5903ABlLWhQQ9nJiF78XFQauZOq0kNSzXIQkjnUpjsTD-XNbY18q3hLceszxs" -H "Content-type: application/json" http://10.0.2.15:8776//v2/7b68039c470b4c9bbd02c375df9b9bfd/volumes/f9255b66-edcc-4aee-81e0-9f7ee2a9342b/metadata -X PUT -d '{"metadata": {"abc": "43434"}}' Request Parameter cinder metadata-update-all [ ...] body: {"metadata": {"abc": "43434"}} Updates volume metadata. Positional arguments: ID of volume for which to update metadata. Metadata key and value pair or pairs to update. Response parameters {"metadata": {"abc": "43434"}} status: 200 3. POST A. Creates a volume. /v2/?{tenant_id}?/volumes Request parameters: curl -H "X-Auth-Token:gAAAAABXOBsPKw7SrcQvroC-DCmpVByT37zSyWnhMGkf7_oajD1qxL2RCcyN-zeFqBHJbkoHmwmn8sAgC6qmqtU_T3lq5Fqzwa-f9OMWi_M9z946lnrP5VCcdAs1NjvYyfkrhojCYoQ-oqt-i_SnQ3-uDUykbZrfMkOpD0jmUzeKd2Nd8vopmjQ" -H "Content-type: application/json" http://10.0.2.15:8776//v2/7b68039c470b4c9bbd02c375df9b9bfd/volumes -X POST -d '{"volume": {"status": "creating", "user_id": null, "name": "sheel_2", "imageRef": null, "availability_zone": null, "description": null, "multiattach": false, "attach_status": "detached", "volume_type": null, "metadata": {}, "consistencygroup_id": null, "source_volid": null, "snapshot_id": null, "project_id": null, "source_replica": null, "size": 1}}' Positional arguments: Size of volume, in GiBs. (Required unless snapshot-id /source-volid is specified). Optional arguments: --consisgroup-id ID of a consistency group where the new volume belongs to. Default=None. --snapshot-id Creates volume from snapshot ID. Default=None. --source-volid Creates volume from volume ID. Default=None. --source-replica Creates volume from replicated volume ID. Default=None. --image-id Creates volume from image ID. Default=None. --image Creates a volume from image (ID or name). Default=None. --name Volume name. Default=None. --description Volume description. Default=None. --volume-type Volume type. Default=None. --availability-zone Availability zone for volume. Default=None. --metadata [ [ ...]] Metadata key and value pairs. Default=None. --hint Scheduler hint, like in nova. --allow-multiattach Allow volume to be attached more than once. Default=False Response parameters {"volume": {"status": "creating", "migration_status": null, "user_id": "be75942374fb4e5891555dc3220a764d", "attachments": [], "links": [{"href": "http://10.0.2.15:8776/v2/7b68039c470b4c9bbd02c375df9b9bfd/volumes/f9255b66-edcc-4aee-81e0-9f7ee2a9342b", "rel": "self"}, {"href": "http://10.0.2.15:8776/7b68039c470b4c9bbd02c375df9b9bfd/volumes/f9255b66-edcc-4aee-81e0-9f7ee2a9342b", "rel": "bookmark"}], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2016-05-15T06:45:57.872495", "description": null, "updated_at": null, "volume_type": "lvmdriver-1", "name": "sheel_2", "replication_status": "disabled", "consistencygroup_id": null, "source_volid": null, "snapshot_id": null, "multiattach": false, "metadata": {}, "id": "f9255b66-edcc-4aee-81e0-9f7ee2a9342b", "size": 1}} Return status 202 B. Create volume metadata /v2/?{tenant_id}?/volumes/?{volume_id}?/metadata cinder metadata [ ...] Sets or deletes volume metadata. Positional arguments: Name or ID of volume for which to update metadata. The action. Valid values are "set" or "unset." Metadata key and value pair to set or unset. For unset, specify only the key. Request curl -H "X-Auth-Token:gAAAAABXOJgxGz4jypkdUDsSKFyf8ap70BP0EluI-fAzvTWlTwotTfiRUeL4zb5xKd1jOmuWjJKlyJCtr9OsZumAhiQuu-n-scCJ_0ASAnZfXaw_P1IxxWLork5903ABlLWhQQ9nJiF78XFQauZOq0kNSzXIQkjnUpjsTD-XNbY18q3hLceszxs" -H "Content-type: application/json" http://10.0.2.15:8776/v2/7b68039c470b4c9bbd02c375df9b9bfd/volumes/f9255b66-edcc-4aee-81e0-9f7ee2a9342b/metadata -X POST -d '{"metadata": {"xyz": "123"}}' Response {"metadata": {"xyz": "123"}} body: {"metadata": {key: value}} status: 200 -------------------------- response is mentioned 2 times metadata {name: ...} and again metadata {name: ...} need to remove one. -------------------------- 4. DELETE Removes one or more volumes. /v2/?{tenant_id}?/volumes/?{volume_id}? cinder delete [ ...] Positional arguments: Name or ID of volume or volumes to delete. curl -H "X-Auth-Token:gAAAAABXODNSOc0_JuqzwRpJmqF815CPo3VCccVUW0UWN9qvdtYOkobQNiJq2_5dLhfN0OZ4c8Kdm2d-Wm8UWL0pLGM4kRd3P4n5vjxxtLR4lO04LCedOIbT1I5IA7Xv63SclFHfehxh5TGXWDAtH7Vb8OJK6-9SueDpmDcXbb09LA_sF1tTHxQ" -H "Content-type: application/json" http://10.0.2.15:8776/v2/7b68039c470b4c9bbd02c375df9b9bfd/volumes/da715dc6-2bf7-494a-8723-13fbf6b32344 -X DELETE no request parameter except volume (Name or ID) and tenant ID. no response parameter This operation does not accept a request body and does not return a response body. status:202 +++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++ Encryption 1. GET 2. PUT 3. POST Create curl -H "X-Auth-Token:a983cd943e7f4017b1c88e097a216899" -H "Content-type: application/json" http://10.0.2.15:8776/v2/f270b245cb11498ca4031deb7e141cfa/types/898016e6-038e-4ae7-baad-2f07b4404567/encryption -X POST -d '{"encryption": {"control_location": "front-end", "cipher": null, "key_size": null, "provider": "LuksEncryptor"}}' {"encryption": {"volume_type_id": "898016e6-038e-4ae7-baad-2f07b4404567", "key_size": null, "control_location": "front-end", "encryption_id": "905302fa-b6b4-40c7-a0c5-5057def39cc7", "cipher": null, "provider": "LuksEncryptor"}}root@sheel:/home/sheel/next/cinder# 4. DELETE curl -H "X-Auth-Token:a983cd943e7f4017b1c88e097a216899" -h http://10.0.2.15:8776/v2/f270b245cb11498ca4031deb7e141cfa/types/898016e6-038e-4ae7-baad-2f07b4404567/encryption -X DELETE DELETE /v2/f270b245cb11498ca4031deb7e141cfa/types/898016e6-038e-4ae7-baad-2f07b4404567/encryption/provider SHEEL action_Args={'project_id': u'f270b245cb11498ca4031deb7e141cfa', 'id': u'provider', 'type_id': u'898016e6-038e-4ae7-baad-2f07b4404567'}