OpenStack Manila Client (python-manilaclient)

raw JSON →
6.0.0 verified Mon Apr 27 auth: no python

Python client library for the OpenStack Shared File Systems API (Manila). Current version 6.0.0, requires Python >=3.10. Release follows OpenStack cycle.

pip install python-manilaclient
error manilaclient.exceptions.AmbiguousEndpoints: Endpoints for manila found multiple times
cause Multiple service endpoints in Keystone catalog (e.g., public and admin).
fix
Set the OS_ENDPOINT_TYPE environment variable to 'publicURL' or 'internalURL'.
error manilaclient.exceptions.Unauthorized: Unauthorized (HTTP 401)
cause Invalid credentials or missing/incorrect OS_AUTH_URL, OS_USERNAME, OS_PASSWORD.
fix
Check OpenStack RC file and ensure environment variables are set correctly.
error ImportError: cannot import name 'Client' from 'manilaclient'
cause Using older install or wrong import path (e.g., 'from manilaclient.client import Client').
fix
Use 'from manilaclient import client' and then instantiate 'client.Client(...)'.
error manilaclient.exceptions.HttpException: The resource could not be found. (HTTP 404)
cause Specifying a share ID or snapshot ID that does not exist, or using v2 API on a v1-only endpoint.
fix
Verify resource IDs. If using v2, ensure Manila API v2 is enabled.
breaking Support for v1 API removed in version 5.0.0. Use v2 API only.
fix Use '2' as the version argument. Ensure your OpenStack deployment supports Manila v2.
breaking Minimum required Python version is now 3.10 (as of 6.0.0).
fix Upgrade Python environment to 3.10 or later.
gotcha The client expects OS_TENANT_NAME (or OS_PROJECT_NAME) for scoping; missing env vars cause authentication errors.
fix Set OS_PROJECT_NAME or OS_TENANT_NAME in environment.
deprecated Use of auth_token parameter is deprecated; prefer session-based authentication.
fix Pass a keystoneauth1 session using the 'session' parameter instead.

Authenticate and list shares.

import os
from manilaclient import client

# Use version 2 (default) or 1
version = '2'
os_username = os.environ.get('OS_USERNAME', '')
os_password = os.environ.get('OS_PASSWORD', '')
os_tenant_name = os.environ.get('OS_TENANT_NAME', '')
os_auth_url = os.environ.get('OS_AUTH_URL', '')

# Authenticate and create client
manila_client = client.Client(version, os_username, os_password, os_tenant_name, os_auth_url)

# List shares
shares = manila_client.shares.list()
print(shares)