Jump to: navigation, search

Difference between revisions of "SharesServiceAPI"

 
m (Robert Esker moved page CinderProtocolEnhancementsAPI to SharesServiceAPI: Reflects refactoring of code - the Shares Service presents a new service.)
 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
 
== Proposed API changes to support Cinder Protocol Enhancements ==
 
  
Background and full spec is here: [[CinderProtocolEnhancements|Cinder Protocol Enhancements]]
+
== Proposed API changes adding a "Shares Service" to Cinder ==
 +
 
 +
Background and full spec is here: [[Shares_Service|Shares Service]]
  
 
'''Create share:'''
 
'''Create share:'''
Line 12: Line 12:
 
Request: <code><nowiki>POST /v1/<tenant_id>/shares</nowiki></code>
 
Request: <code><nowiki>POST /v1/<tenant_id>/shares</nowiki></code>
  
Body:<code><nowiki> {"snapshot_id": null, "display_name": "sh0", "proto": "cifs", "display_description": null, "size": 1}}' </nowiki></code>
+
Body:<code><nowiki> {"share": {"share_type": "nfs", "size": 1}}</nowiki></code>
  
 
Successful response code: <code><nowiki>200</nowiki></code>
 
Successful response code: <code><nowiki>200</nowiki></code>
  
Response body: <code><nowiki> '{"share": {"status": "creating", "display_name": "sh0", "share_type": "CIFS", "export_location": null, "id": "d596078a-7bfb-4977-b10d-2cf5528e708d", "size": 1}}' </nowiki></code>
+
Response body: <code><nowiki>{"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}}</nowiki></code>
  
 
'''Delete share:'''
 
'''Delete share:'''
Line 42: Line 42:
  
 
Response body:
 
Response body:
<code><nowiki> '{"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}]}' </nowiki></code>
+
<code><nowiki> {"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"}]}
 +
</nowiki></code>
  
 
'''Show share:'''
 
'''Show share:'''
Line 56: Line 57:
  
 
Response body:
 
Response body:
<code><nowiki> '{"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}}' </nowiki></code>
+
<code><nowiki>{"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"}}
 +
</nowiki></code>
  
 
'''Allow access to share:'''
 
'''Allow access to share:'''
  
<code><nowiki> cinder share-allow <share_id> <access_type> <access_to> </nowiki></code>
+
<code><nowiki>cinder share-allow <share_id> <access_type> <access_to> </nowiki></code>
  
Note: access_type and access_to depends from the backend. For task4 only 'ip' type is implemented.
+
Note: access_type and access_to depends on the backend.
  
 
Request:
 
Request:
 
<code><nowiki> POST /v1/<tenant_id>/shares/<share_id>/action </nowiki></code>
 
<code><nowiki> POST /v1/<tenant_id>/shares/<share_id>/action </nowiki></code>
  
Body: <code><nowiki> {"os-access_allow": {"access_type": "ip", "access_to": "10.0.1.*"}}' </nowiki></code>
+
Body: <code><nowiki> {"os-allow_access": {"access_type": "ip", "access_to": "10.0.0.0"}} </nowiki></code>
  
 
Successful response code: <code><nowiki>202</nowiki></code>
 
Successful response code: <code><nowiki>202</nowiki></code>
Line 73: Line 75:
 
Response body: <code><nowiki>None</nowiki></code>
 
Response body: <code><nowiki>None</nowiki></code>
  
'''Deny access to share:'''
+
'''List share access rules:'''
  
<code><nowiki>cinder share-deny <share_id> <access_rule_id></nowiki></code>
+
<code><nowiki>cinder share-access-list [share_id]</nowiki></code>
  
 
Request:
 
Request:
<code><nowiki>POST /v1/<tenant_id>/shares/<share_id>/action</nowiki></code>
 
  
Body: <code><nowiki> {"os-access_deny": {"access_id": "20"}} </nowiki></code>
+
<code><nowiki> POST /v1/<tenant_id>/shares/<share_id>/action</nowiki></code>
 +
 
 +
Body: <code><nowiki>{"os-access_list": null} </nowiki></code>
 +
 
 +
 
 +
Successful response code: <code><nowiki>200</nowiki></code>
  
Successful response code: <code><nowiki>202</nowiki></code>
+
Response body:
 +
<code><nowiki> {"access_list": [{"state": "active", "id": "ufd5095f0-173f-46b1-93dd-faa8500dd1bd", "access_type": "ip", "access_to": "10.0.0.0"}]}
 +
</nowiki></code>
  
Response body: <code><nowiki>None</nowiki></code>
 
  
'''List share access rules:'''
+
'''Deny access to share:'''
  
<code><nowiki>cinder share-access-list <share_id></nowiki></code>
+
<code><nowiki>cinder share-deny <share_id> <access_rule_id></nowiki></code>
  
 
Request:
 
Request:
 +
<code><nowiki>POST /v1/<tenant_id>/shares/<share_id>/action</nowiki></code>
  
<pre><nowiki> POST /v1/<tenant_id>/shares/<share_id>/action
+
Body: <code><nowiki> {"os-deny_access": {"access_id": "fd5095f0-173f-46b1-93dd-faa8500dd1bd"}} </nowiki></code>
  
Body: {"os-access_list": null} </nowiki></pre>
+
Successful response code: <code><nowiki>202</nowiki></code>
  
 +
Response body: <code><nowiki>None</nowiki></code>
  
Successful response code: <code><nowiki>200</nowiki></code>
 
 
Response body:
 
<code><nowiki> '{"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.*"}]}' </nowiki></code>
 
  
 
'''Create snapshot from share:'''
 
'''Create snapshot from share:'''
Line 107: Line 112:
  
 
Request:
 
Request:
<code><nowiki>POST /v1/<tenant_id>/snapshots</nowiki></code>
+
<code><nowiki>POST /v1/<tenant_id>/share-snapshots</nowiki></code>
  
Body: <code><nowiki> {"snapshot": {"display_name": "snap0", "force": false, "display_description": null, "volume_id": "7cd97eb7-6d55-418d-964c-858a6bee9d2f"}} </nowiki></code>
+
Body: <code><nowiki> {"share-snapshot": {"share_id": "26d18481-1ce3-4477-80b8-cbcd6e58ab40"}} </nowiki></code>
  
 
Successful response code: <code><nowiki>200</nowiki></code>
 
Successful response code: <code><nowiki>200</nowiki></code>
  
 
Response body:
 
Response body:
<code><nowiki> {"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}} </nowiki></code>
+
<code><nowiki>         {"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}}
 +
</nowiki></code>
  
 
''' Snapshot delete:'''
 
''' Snapshot delete:'''
Line 121: Line 127:
  
 
Request:
 
Request:
 
+
<pre><nowiki> DELETE /v1/<tenant_id>/share-snapshots/<snapshot_id>
<pre><nowiki> DELETE /v1/<tenant_id>/snapshots/<snapshot_id>
 
 
POST /v1/<tenant_id>/snapshots </nowiki></pre>
 
POST /v1/<tenant_id>/snapshots </nowiki></pre>
  
  
<code><nowiki> Body: {"snapshot": {"display_name": "snap0", "force": false, "display_description": null, "volume_id": "7cd97eb7-6d55-418d-964c-858a6bee9d2f"}} </nowiki></code>
+
Body:<code><nowiki> {"share-snapshot": {"share_id": "26d18481-1ce3-4477-80b8-cbcd6e58ab40"}} </nowiki></code>
  
 
Successful response code: <code><nowiki> 200 </nowiki></code>
 
Successful response code: <code><nowiki> 200 </nowiki></code>
  
Response body:
+
Response body: None
  
 
'''Snapshots list:'''
 
'''Snapshots list:'''
Line 138: Line 143:
 
Request:
 
Request:
  
<code><nowiki>GET /v1/<tenant_id>/snapshots/detail</nowiki></code>
+
<code><nowiki>GET /v1/<tenant_id>/share-snapshots</nowiki></code>
  
Body: <code><nowiki> {"snapshot": {"display_name": "snap0", "force": false, "display_description": null, "volume_id": "7cd97eb7-6d55-418d-964c-858a6bee9d2f"}} </nowiki></code>
+
Body: None
  
 
Successful response code: <code><nowiki>200</nowiki></code>
 
Successful response code: <code><nowiki>200</nowiki></code>
  
 
Response body:
 
Response body:
<code><nowiki> {"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}]} </nowiki></code>
+
<code><nowiki> {"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}]}
 +
</nowiki></code>

Latest revision as of 15:04, 29 April 2013

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}]}