Ask Your Question
0

SDKException: Unable to establish connection to http://controller:8774: HTTPConnectionPool(host='controller', port=8774): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fc868315110>:

asked 2017-09-10 23:00:02 -0500

liaodalin19903 gravatar image

After I connect the openstack use openstacksdk, I want to print the servers of conn.compute,

from openstack import connection

    auth_args = {
        'auth_url':settings.AUTH_URL,
        'project_name':'admin',
        'user_domain_name':'default',
        'project_domain_name':'default',
        'username':username,
        'password':password
    }

conn = connection.Connection(**auth_args)

for server in conn.compute.servers(): # there I get error, if I comment these two line, there will not get error.
   print ('_server:' + server)

but the bellow errors:

 2017-09-11 11:47:48,547 DEBUG: keystoneauth.session REQ: curl -g -i -X GET http://103.35.202.1:5000/v3 -H "Accept: application/json" -H "User-Agent: openstacksdk/0.9.18 keystoneauth1/3.2.0 python-requests/2.18.4 CPython/2.7.5"
2017-09-11 11:47:51,892 DEBUG: keystoneauth.session RESP: [200] Date: Mon, 11 Sep 2017 03:48:17 GMT Server: Apache/2.4.6 (CentOS) mod_wsgi/3.4 Python/2.7.5 Vary: X-Auth-Token x-openstack-request-id: req-e4a4bda3-4b5f-40b0-a745-8a218f1795fd Content-Length: 251 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: application/json 
RESP BODY: {"version": {"status": "stable", "updated": "2017-02-22T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v3+json"}], "id": "v3.8", "links": [{"href": "http://103.35.202.1:5000/v3/", "rel": "self"}]}}

2017-09-11 11:47:51,892 DEBUG: keystoneauth.session GET call to None for http://103.35.202.1:5000/v3 used request id req-e4a4bda3-4b5f-40b0-a745-8a218f1795fd
2017-09-11 11:47:51,893 DEBUG: keystoneauth.identity.v3.base Making authentication request to http://103.35.202.1:5000/v3/auth/tokens
2017-09-11 11:47:52,017 DEBUG: keystoneauth.identity.v3.base {"token": {"is_domain": false, "methods": ["password"], "roles": [{"id": "195455939ec1430a8f4cdb82251cb2a8", "name": "admin"}], "expires_at": "2017-09-11T04:48:21.000000Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "99a50773b170406b8902227118bb72bf", "name": "admin"}, "catalog": [{"endpoints": [{"url": "http://controller:9696", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "08071bea57b14fa3b82c013a0421855a"}, {"url": "http://controller:9696", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "77d00cdbfd844b41982b9bc2e91d7fb2"}, {"url": "http://controller:9696", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "f2aa606c7ba3463b92910bdccd2d83c0"}], "type": "network", "id": "08fa6d9433034e2ab5959b6b2aa881c1", "name": "neutron"}, {"endpoints": [{"url": "http://controller:35357/v3", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "07354657196b45d6be5051eca02b0d25"}, {"url": "http://controller:35357/v3", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "966dd220d7754cd197290500deec281a"}, {"url": "http://controller:5000/v3", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "f12767849fbf403b8d58123f226acb2c"}], "type": "identity", "id": "16a100433cbb4979841386a27fac6d4a", "name": "keystone"}, {"endpoints": [{"url": "http://controller:9292", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "5e8ce4eb1c4641489abc5d0e0d017a43"}, {"url": "http://controller:9292", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "7149969ec41044c99cb10640fcc0b919"}, {"url": "http://controller:9292", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "f547fcb105c0405bad04dd2249e430d4"}], "type": "image", "id": "84246a76b5834cd78335342e86e34ee7", "name": "glance"}, {"endpoints": [{"url": "http://controller:8774/v2.1/99a50773b170406b8902227118bb72bf", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "127c06921fe54b78b246648717e63076"}, {"url": "http://controller:8774/v2.1/99a50773b170406b8902227118bb72bf", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "4e45578d5a9943789cf89e3965022a94"}, {"url": "http://controller:8774/v2.1/99a50773b170406b8902227118bb72bf", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "bc1a9130cbbb4927a1daa9be76024c3c"}], "type": "compute", "id": "b3bc33ed199a4405831f3fc62919739c", "name": "nova"}, {"endpoints": [{"url": "http://controller:8778", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "0e745031cdac48dcad52b7363c9148bd"}, {"url": "http://controller:8778", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "2bce354345064a7c8c9558f16ba06de8"}, {"url": "http://controller:8778", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "e066e34cce0445d48cfdef7d80e516cc"}], "type": "placement", "id": "f7dbe60b2b8b442780837296ede5ec79", "name": "placement ...
(more)
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-09-10 23:11:52 -0500

liaodalin19903 gravatar image

The reason is I develop my project not in the openstack machine, so i can not parsing the controller.

The solution is add ip in /etc/hosts:

the_controller_ip( **such as 103.12.123.4** ) controller
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

1 follower

Stats

Asked: 2017-09-10 23:00:02 -0500

Seen: 24 times

Last updated: Sep 10