Jump to: navigation, search

SharesServiceAPI

Revision as of 15:32, 1 October 2012 by Esker (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Proposed API changes to support Cinder Protocol Enhancements

Background and full spec is here: Cinder Protocol Enhancements

Create share:

CLI: cinder share-create [--snapshot_id <snapshot_id>] [--display_name <display_name>] [--display_description <display_description>] <share_protocol> <size>

Note: snapshot id should be used when creating new share from snapshot is required.

Request: POST /v1/<tenant_id>/shares

Body: {"snapshot_id": null, "display_name": "sh0", "proto": "cifs", "display_description": null, "size": 1}}'

Successful response code: 200

Response body: '{"share": {"status": "creating", "display_name": "sh0", "share_type": "CIFS", "export_location": null, "id": "d596078a-7bfb-4977-b10d-2cf5528e708d", "size": 1}}'

Delete share:

cinder share-delete <share_id>

Request: DELETE /v1/<tenant_id>/shares/<share_id>

Body: None

Successful response code: 200

Response body: None

List shares:

cinder share-list

Request: GET /v1/<tenant_id>/shares/detail

Body: None

Successful response code: 200

Response body: '{"shares": [{"status": "available", "display_name": "sh1", "share_type": "NFS", "export_location": "172.18.194.81:/opt/nfs/volume-9d908180-f9ea-42b2-9079-88a59ade5339", "id": "9d908180-f9ea-42b2-9079-88a59ade5339", "size": 1}, {"status": "available", "display_name": "sh0", "share_type": "CIFS", "export_location": "//172.18.194.81/volume-adcc79e4-336c-4ad2-9d38-2b65d062d971", "id": "adcc79e4-336c-4ad2-9d38-2b65d062d971", "size": 1}]}'

Show share:

cinder share-show <share_id>

Request: GET /v1/<tenant_id>/shares/<share_id>

Body: None

Successful response code: 200

Response body: '{"share": {"status": "available", "display_name": "sh0", "share_type": "CIFS", "export_location": "//172.18.194.81/volume-adcc79e4-336c-4ad2-9d38-2b65d062d971", "id": "adcc79e4-336c-4ad2-9d38-2b65d062d971", "size": 1}}'

Allow access to share:

cinder share-allow <share_id> <access_type> <access_to>

Note: access_type and access_to depends from the backend. For task4 only 'ip' type is implemented.

Request: POST /v1/<tenant_id>/shares/<share_id>/action

Body: {"os-access_allow": {"access_type": "ip", "access_to": "10.0.1.*"}}'

Successful response code: 202

Response body: None

Deny access to share:

cinder share-deny <share_id> <access_rule_id>

Request: POST /v1/<tenant_id>/shares/<share_id>/action

Body: {"os-access_deny": {"access_id": "20"}}

Successful response code: 202

Response body: None

List share access rules:

cinder share-access-list <share_id>

Request:

 POST /v1/<tenant_id>/shares/<share_id>/action

Body: {"os-access_list": null} 


Successful response code: 200

Response body: '{"access_list": [{"state": "active", "id": 20, "access_type": "ip", "access_to": "10.0.0.*"}, {"state": "active", "id": 21, "access_type": "ip", "access_to": "10.0.1.*"}]}'

Create snapshot from share:

cinder snapshot-create [--force <True|False>] [--display_name <display_name>] [--display_description <display_description>] <volume_id>

Request: POST /v1/<tenant_id>/snapshots

Body: {"snapshot": {"display_name": "snap0", "force": false, "display_description": null, "volume_id": "7cd97eb7-6d55-418d-964c-858a6bee9d2f"}}

Successful response code: 200

Response body: {"snapshot": {"status": "creating", "display_name": "snap0", "created_at": "2012-08-21 11:25:44.668712", "display_description": null, "source_type": "NFS", "volume_id": "7cd97eb7-6d55-418d-964c-858a6bee9d2f", "id": "b8531da9-de22-4df0-8e40-ffbe7d290811", "size": 1}}

Snapshot delete:

cinder snapshot-delete <snapshot_id>

Request:

 DELETE /v1/<tenant_id>/snapshots/<snapshot_id>
POST /v1/<tenant_id>/snapshots 


Body: {"snapshot": {"display_name": "snap0", "force": false, "display_description": null, "volume_id": "7cd97eb7-6d55-418d-964c-858a6bee9d2f"}}

Successful response code: 200

Response body:

Snapshots list:

cinder snapshot-list

Request:

GET /v1/<tenant_id>/snapshots/detail

Body: {"snapshot": {"display_name": "snap0", "force": false, "display_description": null, "volume_id": "7cd97eb7-6d55-418d-964c-858a6bee9d2f"}}

Successful response code: 200

Response body: {"snapshots": [{"status": "available", "display_name": "snap0", "created_at": "2012-08-21 11:25:44", "display_description": null, "id": "b8531da9-de22-4df0-8e40-ffbe7d290811", "source_type": "NFS", "volume_id": "7cd97eb7-6d55-418d-964c-858a6bee9d2f", "os-extended-snapshot-attributes:progress": "100%", "os-extended-snapshot-attributes:project_id": "cc629b78b21142699a36ee0749749720", "size": 1}]}