Jump to: navigation, search

SharesServiceAPI

Proposed API changes adding a "Shares Service" to Cinder

Background and full spec is here: Shares Service

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: {"share": {"share_type": "nfs", "size": 1}}

Successful response code: 200

Response body: {"share": {"id": "26d18481-1ce3-4477-80b8-cbcd6e58ab40", "links": [{"href": "http://10.63.165.30:8776/v1/99600daa104f4be0b0860a9358ec6df2/shares/26d18481-1ce3-4477-80b8-cbcd6e58ab40", "rel": "self"}, {"href": "http://10.63.165.30:8776/99600daa104f4be0b0860a9358ec6df2/shares/26d18481-1ce3-4477-80b8-cbcd6e58ab40", "rel": "bookmark"}], "name": null}}

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", "description": null, "links": [{"href": "http://10.63.165.30:8776/v1/99600daa104f4be0b0860a9358ec6df2/shares/26d18481-1ce3-4477-80b8-cbcd6e58ab40", "rel": "self"}, {"href": "http://10.63.165.30:8776/99600daa104f4be0b0860a9358ec6df2/shares/26d18481-1ce3-4477-80b8-cbcd6e58ab40", "rel": "bookmark"}], "availability_zone": "nova", "snapshot_id": null, "id": "26d18481-1ce3-4477-80b8-cbcd6e58ab40", "size": 1, "name": null, "share_type": "NFS", "created_at": "2013-04-05T11:03:52.000000", "export_location": "10.63.165.30:/opt/stack/data/cinder/mnt/share-26d18481-1ce3-4477-80b8-cbcd6e58ab40"}]}

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", "description": null, "links": [{"href": "http://10.63.165.30:8776/v1/99600daa104f4be0b0860a9358ec6df2/shares/26d18481-1ce3-4477-80b8-cbcd6e58ab40", "rel": "self"}, {"href": "http://10.63.165.30:8776/99600daa104f4be0b0860a9358ec6df2/shares/26d18481-1ce3-4477-80b8-cbcd6e58ab40", "rel": "bookmark"}], "availability_zone": "nova", "snapshot_id": null, "id": "26d18481-1ce3-4477-80b8-cbcd6e58ab40", "size": 1, "name": null, "share_type": "NFS", "created_at": "2013-04-05T11:03:52.000000", "export_location": "10.63.165.30:/opt/stack/data/cinder/mnt/share-26d18481-1ce3-4477-80b8-cbcd6e58ab40"}}

Allow access to share:

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

Note: access_type and access_to depends on the backend.

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

Body: {"os-allow_access": {"access_type": "ip", "access_to": "10.0.0.0"}}

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": "ufd5095f0-173f-46b1-93dd-faa8500dd1bd", "access_type": "ip", "access_to": "10.0.0.0"}]}


Deny access to share:

cinder share-deny <share_id> <access_rule_id>

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

Body: {"os-deny_access": {"access_id": "fd5095f0-173f-46b1-93dd-faa8500dd1bd"}}

Successful response code: 202

Response body: None


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>/share-snapshots

Body: {"share-snapshot": {"share_id": "26d18481-1ce3-4477-80b8-cbcd6e58ab40"}}

Successful response code: 200

Response body: {"share-snapshot": {"id": "a4a6ec00-3aac-4ce1-b396-aa815280893e", "links": [{"href": "http://10.63.165.30:8776/v1/99600daa104f4be0b0860a9358ec6df2/share-snapshots/a4a6ec00-3aac-4ce1-b396-aa815280893e", "rel": "self"}, {"href": "http://10.63.165.30:8776/99600daa104f4be0b0860a9358ec6df2/share-snapshots/a4a6ec00-3aac-4ce1-b396-aa815280893e", "rel": "bookmark"}], "name": null}}

Snapshot delete:

cinder snapshot-delete <snapshot_id>

Request:

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


Body: {"share-snapshot": {"share_id": "26d18481-1ce3-4477-80b8-cbcd6e58ab40"}}

Successful response code: 200

Response body: None

Snapshots list:

cinder snapshot-list

Request:

GET /v1/<tenant_id>/share-snapshots

Body: None

Successful response code: 200

Response body: {"share-snapshots": [{"id": "a4a6ec00-3aac-4ce1-b396-aa815280893e", "links": [{"href": "http://10.63.165.30:8776/v1/99600daa104f4be0b0860a9358ec6df2/share-snapshots/a4a6ec00-3aac-4ce1-b396-aa815280893e", "rel": "self"}, {"href": "http://10.63.165.30:8776/99600daa104f4be0b0860a9358ec6df2/share-snapshots/a4a6ec00-3aac-4ce1-b396-aa815280893e", "rel": "bookmark"}], "name": null}]}