Created
May 3, 2017 10:05
-
-
Save e0ne/bf04d763e222a22976c8745dd28970da to your computer and use it in GitHub Desktop.
python-cinderclient noauth Python API example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import brick_cinderclient_ext | |
from cinderclient import client | |
from cinderclient.contrib import noauth | |
from keystoneauth1 import loading | |
from keystoneauth1 import session | |
bypass_url = "http://172.29.236.100:8776/v3" | |
project_id = "cinderflex" | |
auth_plugin = noauth.CinderNoAuthPlugin('', | |
project_id, | |
None, | |
bypass_url) | |
loader = loading.get_plugin_loader('noauth') | |
auth = loader.load_from_options(endpoint=bypass_url, | |
user_id="foo", | |
project_id="cinderflex") | |
sess = session.Session(auth=auth) | |
c = client.Client( | |
3, | |
'password', 'cinderflex', bypass_url, | |
tenant_id='cinderflex', | |
bypass_url=bypass_url, | |
auth_plugin=auth_plugin, | |
session=sess) | |
print(c.volumes.list()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment