Search code examples
vmwareopenstackkeystonelibcloud

Openstack Authentication issue when using libcloud


from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

import libcloud.security

auth_usr   = '[email protected]'
auth_pass  = '*********'
auth_url   = 'https://ccc.sss.com:5000/v2.0'
project_name = 'POC'
region_name = ''

libcloud.security.VERIFY_SSL_CERT = False

provider = get_driver(Provider.OPENSTACK)
conn = provider(auth_usr,
                auth_pass,
                ex_force_auth_url=auth_url,
                ex_force_auth_version='2.0_password',
                ex_tenant_name=project_name,
                ex_force_service_region=region_name)

images = conn.list_images()

for image in images:
    print(image)

Results in the following error:

BaseHTTPError: {"error": {"message": "get_version_v2() got an unexpected keyword argument 'auth'", "code": 400, "title": "Bad Request"}}

I've also tried stripping the v2.0 from the url and also adding /tokens. Neither work, and they result in a "cannot find endpoint" error.

I'm using vmware integrated OpenStack.


Solution

  • OK turns out in my case that you need to set the region to "nova" for it to work.

    ex_force_service_region="nova"
    

    I had to trace through the code in pyDev to determine that it was the region not matching that was the issue.