Add more detail to API introduction
Creating a share in Manila requires an existing share-type so this change adds a deeper usage example that includes creation of a share-type, allowing share access to an IP range, and demonstrates reading export_locations from a share Change-Id: I1dd8271bed80a727901a4ee98182b4790790931e
This commit is contained in:
parent
0ca91287ac
commit
c07a11194f
@ -24,3 +24,27 @@ done so, you can use the API like so::
|
||||
[<Share: ce06d0a8-5c1b-4e2c-81d2-39eca6bbfb70>]
|
||||
>>>share.delete
|
||||
|
||||
In addition to creating and deleting shares, the manilaclient can manage
|
||||
share-types, access controls, and more! Using CephFS with Ganesha for NFS
|
||||
support as an example (assuumes this continues from the above initialization)::
|
||||
|
||||
>>> share_type = client.share_types.create(
|
||||
>>> name="cephfsnfstype", spec_driver_handles_share_servers=False,
|
||||
>>> extra_specs={
|
||||
>>> 'vendor_name': 'Ceph',
|
||||
>>> 'storage_protocol': 'NFS',
|
||||
>>> 'snapshot_support': False,
|
||||
>>> })
|
||||
>>> share_type
|
||||
<ShareType: cephfsnfstype>
|
||||
>>> share = client.shares.create(
|
||||
>>> share_type='cephfsnfstype', name='cephnfsshare1',
|
||||
>>> share_proto="nfs", size=1)
|
||||
>>> share.allow(access_type='ip', access="192.168.0.0/24", access_level='rw')
|
||||
{'id': '29bc4b66-d55d-424d-8107-aee96d1c562b', 'share_id': '0ac95dd2-afba-4ba3-8934-721b29492f04', 'access_level': 'rw', 'access_to': '192.168.0.0/24', 'access_type': 'ip', 'state': 'new'}
|
||||
>>> share.export_locations
|
||||
['10.5.0.22:/volumes/_nogroup/cf0451b6-0a95-4982-a801-2e212e9c9b96']
|
||||
|
||||
In the above example, Manila will be setup with an NFS share type, backed
|
||||
by CephFS. A share is then created, and then access controls are added giving
|
||||
the 192.168.0/24 subnet read/write access to the share.
|
||||
|
Loading…
x
Reference in New Issue
Block a user