Skip to content

Programmatic Access

Programmatic access to Manila

While the Manila client provides human readable access to Manila, using the Manila client Python modules will allow to integrate programmatic access to Manila in Python programs. A third way of interaction, for instance in order to get JSON formatted data, is sending direct requests to the Manila APIs with curl.

For this, you need to get the endpoint url from the catalog, e.g.:

$ MANILA_URL=`openstack catalog show manilav2 | grep public | awk '{print $4}'`

and a user token

$ USER_TOKEN=`openstack token issue | grep "| id" | awk '{print $4}'`

With this the following curl command will return a JSON fomratted list of the shares in the project:

curl -i -X GET \
-H "X-Auth-Token: $USER_TOKEN" \
-H "X-Openstack-Manila-Api-Version: 2.32" \

which can be processed, for instance with 'jq':

$ curl -s  -X GET \
-H "X-Auth-Token: $USER_TOKEN" \
-H "X-Openstack-Manila-Api-Version: 2.32" \
$MANILA_URL/shares/detail|jq '.shares[].name'

The Manila API reference for a complete list of calls is available from OpenStack Manila API.

Last update: July 3, 2019