Why doesn't this libcloud app connect?
i'm trying to use the firstapp tutorial and I'm sure I'm missing something obvious. here's my code:
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
auth_username = 'admin'
auth_password = 'admin'
auth_url = 'http://172.16.0.2:5000/v2.0/'
project_name = 'admin'
region_name = 'RegionOne'
provider = get_driver(Provider.OPENSTACK)
conn = provider(auth_username,
auth_password,
ex_force_auth_url=auth_url,
ex_force_auth_version='2.0_password',
ex_tenant_name=project_name,
ex_force_service_region=region_name)
flavors = conn.list_sizes()
for flavor in flavors:
print(flavor)
The credentials should work; I've tried them manually:
nick@virtualdocs:~/pythonfirstapp$ nova --os-username=admin --os-tenant-name=admin --os-auth-url=http://172.16.0.2:5000/v2.0 list
OS Password:
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+
And yet, when I run the python app, I'm getting an error:
Traceback (most recent call last):
File "sample.py", line 18, in <module>
flavors = conn.list_sizes()
File "/usr/local/lib/python2.7/dist-packages/libcloud/compute/drivers/openstack.py", line 246, in list_sizes
self.connection.request('/flavors/detail').object)
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/openstack.py", line 200, in request
raw=raw)
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/base.py", line 657, in request
action = self.morph_action_hook(action)
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/openstack.py", line 255, in morph_action_hook
self._populate_hosts_and_request_paths()
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/openstack.py", line 288, in _populate_hosts_and_request_paths
osa = osa.authenticate(**kwargs) # may throw InvalidCreds
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/openstack_identity.py", line 841, in authenticate
return self._authenticate_2_0_with_password()
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/openstack_identity.py", line 866, in _authenticate_2_0_with_password
return self._authenticate_2_0_with_body(reqbody)
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/openstack_identity.py", line 871, in _authenticate_2_0_with_body
method='POST')
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/base.py", line 736, in request
response = responseCls(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/base.py", line 117, in __init__
raise Exception(self.parse_error())
Exception: {"error": {"message": "get_version_v2() got an unexpected keyword argument 'auth'", "code": 400, "title": "Bad Request"}}
I'm running this on Ubuntu 12.04 in VirtualBox, against Mirantis OpenStack 6.1. I'm sure I'm missing something obvious but for the life of me I can't see what it is.
Thanks in advance....
[UPDATE: I've since successfully connected using JClouds, so there's nothing wrong with the OpenStack install itself.]
[Second UPDATE: In response to the suggestion that I missed the "v" in the authentication URL -- thanks! -- I've updated the code and the response. Unfortunately it still doesn't work. :( ]
you need to check Nova logs to get the full picture
@nickchase Have you tried out it?