openstack - Getting a list of block storage volumes at Rackspace using novaclient Python API -
i'm trying list of block storage volumes have on rackspace account using novaclient python api. here's code i'm using:
from rackspace_auth_openstack.plugin import rackspaceauthplugin rackspace_auth_openstack.plugin import auth_url_us novaclient.client import client nova = client(version = 2, username = '******', project_id = '******', api_key = '******************************', region_name = 'dfw', auth_system = 'rackspace', auth_plugin = rackspaceauthplugin(), auth_url = auth_url_us()) print nova.servers.list() print nova.volumes.list()
all of libraries installed using pip install --upgrade rackspace-novaclient
should using lastest version of libraries. here's results of running above code:
$ python test.py [<server: svr01>, <server: svr02>] traceback (most recent call last): file "test.py", line 16, in <module> print nova.volumes.list() file "/usr/lib/python2.7/site-packages/novaclient/v1_1/volumes.py", line 95, in list return self._list("/volumes/detail%s" % query_string, "volumes") file "/usr/lib/python2.7/site-packages/novaclient/base.py", line 64, in _list _resp, body = self.api.client.get(url) file "/usr/lib/python2.7/site-packages/novaclient/client.py", line 283, in return self._cs_request(url, 'get', **kwargs) file "/usr/lib/python2.7/site-packages/novaclient/client.py", line 260, in _cs_request **kwargs) file "/usr/lib/python2.7/site-packages/novaclient/client.py", line 242, in _time_request resp, body = self.request(url, method, **kwargs) file "/usr/lib/python2.7/site-packages/novaclient/client.py", line 236, in request raise exceptions.from_response(resp, body, url, method) novaclient.exceptions.notfound: not found (http 404)
the server list api call works, i'm pretty sure i'm authenticating properly. cli command nova volume-list
works appear i'm missing code.
since cloud block storage api under different endpoint, have specify service_type
from rackspace_auth_openstack.plugin import rackspaceauthplugin, auth_url_us novaclient.client import client nova = client(version = 2, username = '******', project_id = '******', api_key = '******************************', region_name = 'dfw', auth_system = 'rackspace', auth_plugin = rackspaceauthplugin(), auth_url = auth_url_us(), service_type = 'volume') # right here print nova.volumes.list()
Comments
Post a Comment