Ask Your Question

Why doesn't this libcloud app connect?

asked 2015-09-12 13:05:02 -0600

nickchase gravatar image

updated 2015-09-18 00:42:45 -0600

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 = ''
project_name = 'admin'
region_name = 'RegionOne'

provider = get_driver(Provider.OPENSTACK)
conn = provider(auth_username,

flavors = conn.list_sizes()
for flavor in flavors:

The credentials should work; I've tried them manually:

nick@virtualdocs:~/pythonfirstapp$ nova --os-username=admin --os-tenant-name=admin --os-auth-url= 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 "", line 18, in <module>
    flavors = conn.list_sizes()
  File "/usr/local/lib/python2.7/dist-packages/libcloud/compute/drivers/", line 246, in list_sizes
  File "/usr/local/lib/python2.7/dist-packages/libcloud/common/", line 200, in request
  File "/usr/local/lib/python2.7/dist-packages/libcloud/common/", line 657, in request
    action = self.morph_action_hook(action)
  File "/usr/local/lib/python2.7/dist-packages/libcloud/common/", line 255, in morph_action_hook
  File "/usr/local/lib/python2.7/dist-packages/libcloud/common/", 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/", line 841, in authenticate
    return self._authenticate_2_0_with_password()
  File "/usr/local/lib/python2.7/dist-packages/libcloud/common/", 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/", line 871, in _authenticate_2_0_with_body
  File "/usr/local/lib/python2.7/dist-packages/libcloud/common/", line 736, in request
    response = responseCls(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/libcloud/common/", 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. :( ]

edit retag flag offensive close merge delete


you need to check Nova logs to get the full picture

smaffulli gravatar imagesmaffulli ( 2016-01-15 10:45:14 -0600 )edit

@nickchase Have you tried out it?

liaodalin19903 gravatar imageliaodalin19903 ( 2017-09-14 02:15:01 -0600 )edit

4 answers

Sort by ยป oldest newest most voted

answered 2015-09-14 10:56:52 -0600

miguelgrinberg gravatar image

Try setting your auth url as follows:

 auth_url = ''

There is a missing 'v' in the last portion, I think.

edit flag offensive delete link more


Still no joy. I've updated the question to reflect the new code, as well as the new error. :(

nickchase gravatar imagenickchase ( 2015-09-18 01:21:37 -0600 )edit

Can we use v3? how to use v3?

liaodalin19903 gravatar imageliaodalin19903 ( 2017-09-14 02:09:50 -0600 )edit

answered 2016-02-12 11:06:27 -0600

macleanal gravatar image

I experienced this same error, but then by appending '/tokens' to the auth_url I connected successfully.

edit flag offensive delete link more

answered 2016-07-18 06:06:25 -0600

heena gravatar image

Getting the same error. Has there been an answer to this? Is python or openstack version an issue?

edit flag offensive delete link more


@heena Have you tried out it>\?

liaodalin19903 gravatar imageliaodalin19903 ( 2017-09-14 02:17:27 -0600 )edit

answered 2015-09-20 10:11:43 -0600

avi gravatar image

Using libcloud version 0.17.1-dev (libcloud/ defines __version__) against latest devstack -- works for me. Please note that if I append /v2.0/ to auth_url then I get identical error as you did.

Here is my libcloud snippet:

from pprint import pprint

from libcloud.compute.providers import get_driver \
    as compute_get_driver
from libcloud.compute.types import Provider as compute_provider

USER_NAME = 'admin'
PASSWORD = 'labstack'
TENANT_NAME = 'admin'
AUTH_URL = 'http://xx.xx.xx.xx:5000'
region_name = 'RegionOne'

driver = compute_get_driver(compute_provider.OPENSTACK)(
    USER_NAME, PASSWORD, ex_tenant_name=TENANT_NAME,

images = driver.list_images()
sizes = driver.list_sizes()


Running it gives the below output:

[<NodeImage: id=56c1cdb1-1db2-45fc-9465-31c47e0aefab, name=cirros-0.3.4-x86_64-uec, driver=OpenStack  ...>,
 <NodeImage: id=28c0ee08-8986-43ee-b769-41d9103d9931, name=cirros-0.3.4-x86_64-uec-ramdisk, driver=OpenStack  ...>,
 <NodeImage: id=0365d096-f0a7-4eef-a0d0-a509f38f3008, name=cirros-0.3.4-x86_64-uec-kernel, driver=OpenStack  ...>]
[<OpenStackNodeSize: id=1, name=m1.tiny, ram=512, disk=1, bandwidth=None, price=0.0, driver=OpenStack, vcpus=1,  ...>,
 <OpenStackNodeSize: id=2, name=m1.small, ram=2048, disk=20, bandwidth=None, price=0.0, driver=OpenStack, vcpus=1,  ...>,
 <OpenStackNodeSize: id=3, name=m1.medium, ram=4096, disk=40, bandwidth=None, price=0.0, driver=OpenStack, vcpus=2,  ...>,
 <OpenStackNodeSize: id=4, name=m1.large, ram=8192, disk=80, bandwidth=None, price=0.0, driver=OpenStack, vcpus=4,  ...>,
 <OpenStackNodeSize: id=42, name=m1.nano, ram=64, disk=0, bandwidth=None, price=0.0, driver=OpenStack, vcpus=1,  ...>,
 <OpenStackNodeSize: id=5, name=m1.xlarge, ram=16384, disk=160, bandwidth=None, price=0.0, driver=OpenStack, vcpus=8,  ...>,
 <OpenStackNodeSize: id=84, name=m1.micro, ram=128, disk=0, bandwidth=None, price=0.0, driver=OpenStack, vcpus=1,  ...>]
edit flag offensive delete link more


But when I list_images() there comes object of type 'bool' has no len() error.

liaodalin19903 gravatar imageliaodalin19903 ( 2017-09-14 02:23:46 -0600 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2015-09-12 13:05:02 -0600

Seen: 696 times

Last updated: Jul 18 '16