Ask Your Question
0

unable to establish connection to localhost

asked 2015-10-06 11:55:53 -0500

faabiioo gravatar image

Hello,

I have searched for an answer here, but I could not figure out a solution to my problem. I have my project on OpenStack with some instances running. I can easily access them through ssh.

I want to use python SDK to access Openstack APIs, but first I tried with CLI. Following the OpenStack CLI user-guide, I installed today the novel python-openstackclient and others needed. Then I downloaded my project-openrc.sh and sourced it, and then tried to establish a connection: every command I attempt to execute (openstack service list, openstack image list, glance image-list, etc.) always fails with the same error: ERROR (ConnectionRefused): unable to establish connection to http://localhost:5000/v2.0/tokens.

Am I missing something here? Why is it trying to connect to localhost, even though in my openrc the specified URL is different:

$ echo $OS_AUTH_URL
$ http://163.117.148.100:5000/v2.0

If I run the command openstack --debug user list I get the following output:

...
Using parameters {'username': 'USERNAME', 'password': 'PASSWORD', 'project_name': 'PROJECT', 'project_id': 'PROJECT_ID', 'auth_url': 'http://163.117.148.100:5000/v2.0'}
Get auth_ref
REQ: curl -g -i -X GET http://163.117.148.100:5000/v2.0 -H "Accept: application/json" -H "User-Agent: python-openstackclient"
Starting new HTTP connection (1): 163.117.148.100
"GET /v2.0 HTTP/1.1" 200 612
RESP: [200] Date: Tue, 06 Oct 2015 16:38:00 GMT Vary: X-Auth-Token Content-Length: 612 Content-Type: application/json Connection: keep-alive 
RESP BODY: {"version": {"status": "stable", "updated": "2013-03-06T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v2.0+json"}, {"base": "application/xml", "type": "application/vnd.openstack.identity-v2.0+xml"}], "id": "v2.0", "links": [{"href": "http://localhost:5000/v2.0/", "rel": "self"}, {"href": "http://docs.openstack.org/api/openstack-identity-service/2.0/content/", "type": "text/html", "rel": "describedby"}, {"href": "http://docs.openstack.org/api/openstack-identity-service/2.0/identity-dev-guide-2.0.pdf", "type": "application/pdf", "rel": "describedby"}]}}

Making authentication request to http://localhost:5000/v2.0/tokens
Starting new HTTP connection (1): localhost
Request to http://localhost:5000/v2.0/tokens timed out (HTTP 408)
Traceback (most recent call last):
...

At the beginning it succeeds to connect to the correct address, then in the response body appears this "href": "http://localhost:5000/v2.0/", "rel": "self", and then it makes an authentication request to localhost.

I'm sure I misunderstood some things about configuration and authentication, but I don't seem to find out what. Can someone help me with this trouble?

Thanks in advance

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-11-09 07:23:03 -0500

atze.devries gravatar image

updated 2015-11-09 07:28:08 -0500

Having the exact same issue over here. Even if i just run

curl url.of.openstack:5000/v2.0

it returns

{"version": {"status": "stable", "updated": "2013-03-06T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v2.0+json"}, {"base": "application/xml", "type": "application/vnd.openstack.identity-v2.0+xml"}], "id": "v2.0", "links": [{"href": "http://localhost:5000/v2.0/", "rel": "self"}, {"href": "http://docs.openstack.org/api/openstack-identity-service/2.0/content/", "type": "text/html", "rel": "describedby"}, {"href": "http://docs.openstack.org/api/openstack-identity-service/2.0/identity-dev-guide-2.0.pdf", "type": "application/pdf", "rel": "describedby"}]}}%

SOLUTION for ME

edit /etc/keystone/keystone.conf

change

public_endpoint = http://localhost:%(public_port)s/

to

public_endpoint = http://url.to.openstack:5000/
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

3 followers

Stats

Asked: 2015-10-06 09:48:13 -0500

Seen: 4,325 times

Last updated: Nov 09 '15