[image] registry_host in glance-api.conf is different from bind_host in glance-registry.conf

Bug #1459169 reported by YangLei on 2015-05-27
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack + Chef
Undecided
YangLei

Bug Description

registry_host in glance-api.conf need equal bind_host in glance-registry.conf by default, otherwise glance-api will raise Exception ClientConnectionError.

[root@controller ~]# grep registry_host /etc/glance/glance-api.conf
#registry_host = 0.0.0.0
registry_host = 10.6.1.108
[root@controller ~]# grep bind_host /etc/glance/glance-registry.conf
#bind_host = 0.0.0.0
bind_host = 127.0.0.1
[root@controller ~]#

./openstack-common/attributes/default.rb:default['openstack']['endpoints']['image-registry-bind']['host'] = node['openstack']['endpoints']['bind-host']
./openstack-common/attributes/default.rb:default['openstack']['endpoints']['image-registry']['host'] = node['openstack']['endpoints']['host']

-----------------------error
[root@controller glance]# netstat -anp | grep 9191
tcp 0 0 127.0.0.1:9191 0.0.0.0:* LISTEN 31170/python
[root@controller glance]# ps -ef | grep 31170
glance 31170 1 0 11:57 ? 00:00:04 /usr/bin/python /usr/bin/glance-registry --config-file /etc/glance/glance-registry.conf --log-file /var/log/glance/registry.log
glance 31189 31170 0 11:58 ? 00:00:00 /usr/bin/python /usr/bin/glance-registry --config-file /etc/glance/glance-registry.conf --log-file /var/log/glance/registry.log
glance 31190 31170 0 11:58 ? 00:00:00 /usr/bin/python /usr/bin/glance-registry --config-file /etc/glance/glance-registry.conf --log-file /var/log/glance/registry.log
root 32199 26536 0 12:05 pts/1 00:00:00 grep --color=auto 31170
[root@controller glance]#

[root@controller glance]# wget http://10.6.1.108:9191/images/detail
--2015-05-07 12:04:25-- http://10.6.1.108:9191/images/detail
Connecting to 10.6.1.108:9191... failed: Connection refused.
[root@controller glance]# wget http://127.0.0.1:9191/images/detail
--2015-05-07 12:04:36-- http://127.0.0.1:9191/images/detail
Connecting to 127.0.0.1:9191... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authorization failed.
[root@controller glance]#

2015-05-07 12:00:39.177 31573 DEBUG glance.common.client [req-fed3038e-7d56-4f3a-8cb7-2ae3191374f9 a40f86695f5e4787b64c6565f4a22682 a15ca35b95b0486d9832743bc2d5a3f0 - - -] GL-A8EF472 Constructed URL: http://10.6.1.108:9191/images/detail?is_public=none&limit=500 _construct_url /usr/lib/python2.7/site-packages/glance/common/client.py:401
2015-05-07 12:00:39.182 31573 ERROR glance.registry.client.v1.client [req-fed3038e-7d56-4f3a-8cb7-2ae3191374f9 a40f86695f5e4787b64c6565f4a22682 a15ca35b95b0486d9832743bc2d5a3f0 - - -] Registry client request GET /images/detail raised ClientConnectionError
2015-05-07 12:00:39.182 31573 TRACE glance.registry.client.v1.client Traceback (most recent call last):
2015-05-07 12:00:39.182 31573 TRACE glance.registry.client.v1.client File "/usr/lib/python2.7/site-packages/glance/registry/client/v1/client.py", line 117, in do_request
2015-05-07 12:00:39.182 31573 TRACE glance.registry.client.v1.client **kwargs)
2015-05-07 12:00:39.182 31573 TRACE glance.registry.client.v1.client File "/usr/lib/python2.7/site-packages/glance/common/client.py", line 71, in wrapped
2015-05-07 12:00:39.182 31573 TRACE glance.registry.client.v1.client return func(self, *args, **kwargs)
2015-05-07 12:00:39.182 31573 TRACE glance.registry.client.v1.client File "/usr/lib/python2.7/site-packages/glance/common/client.py", line 376, in do_request
2015-05-07 12:00:39.182 31573 TRACE glance.registry.client.v1.client headers=copy.deepcopy(headers))
2015-05-07 12:00:39.182 31573 TRACE glance.registry.client.v1.client File "/usr/lib/python2.7/site-packages/glance/common/client.py", line 88, in wrapped
2015-05-07 12:00:39.182 31573 TRACE glance.registry.client.v1.client return func(self, method, url, body, headers)
2015-05-07 12:00:39.182 31573 TRACE glance.registry.client.v1.client File "/usr/lib/python2.7/site-packages/glance/common/client.py", line 542, in _do_request
2015-05-07 12:00:39.182 31573 TRACE glance.registry.client.v1.client raise exception.ClientConnectionError(e)
2015-05-07 12:00:39.182 31573 TRACE glance.registry.client.v1.client ClientConnectionError: [Errno 111] ECONNREFUSED
2015-05-07 12:00:39.182 31573 TRACE glance.registry.client.v1.client
2

YangLei (yanglyy) on 2015-05-27
Changed in openstack-chef:
assignee: nobody → YangLei (yanglyy)
YangLei (yanglyy) on 2015-05-27
description: updated
Changed in openstack-chef:
assignee: YangLei (yanglyy) → nobody
assignee: nobody → YangLei (yanglyy)
summary: - registry_host in glance-api.conf is different from bind_host in glance-
- registry.conf
+ [image] registry_host in glance-api.conf is different from bind_host in
+ glance-registry.conf
tags: added: image
Changed in openstack-chef:
importance: Undecided → Medium
status: New → Confirmed
milestone: none → kilo-rc1
Changed in openstack-chef:
status: Confirmed → In Progress
YangLei (yanglyy) wrote :

submit the code review, But it seems there are some disaggreement on this.
https://review.openstack.org/#/c/185914/

Fix proposed to branch: master
Review: https://review.openstack.org/188576

Changed in openstack-chef:
assignee: YangLei (yanglyy) → Mark Vanderwiel (vanderwl)
Mark Vanderwiel (vanderwl) wrote :

Seems like what your missing is to explicitly set the registry bind-host attribute in Common: https://github.com/stackforge/cookbook-openstack-common/blob/master/attributes/default.rb#L367
If it's not set, it will default to 127.0.0.1 from https://github.com/stackforge/cookbook-openstack-common/blob/master/attributes/default.rb#L194

YangLei (yanglyy) wrote :

glance-registry will use default['openstack']['endpoints']['image-registry-bind']['host'] to start up service.
glance-api will connect glance-registry with default['openstack']['endpoints']['image-registry']['host']

so We need make sure that
default['openstack']['endpoints']['image-registry-bind']['host']
and
default['openstack']['endpoints']['image-registry']['host']
have same value.

otherwise glance-api will fail to connect glance-registry.

https://github.com/stackforge/cookbook-openstack-common/blob/master/attributes/default.rb#L367
https://github.com/stackforge/cookbook-openstack-common/blob/master/attributes/default.rb#L371

Changed in openstack-chef:
assignee: Mark Vanderwiel (vanderwl) → YangLei (yanglyy)
YangLei (yanglyy) wrote :

We can set the different IP for bind-host and host in environment:
openstack.endpoints.bind-host = IP1
openstack.endpoints.host = IP2

Regarding image, glance-registry will use bind-host(IP1) to start up, but glance-api will use host(IP2) to connect glance-registry.
but It will fail to connect glance-registry due to the different IPs.

default['openstack']['endpoints']['image-registry-bind']['host'] = node['openstack']['endpoints']['bind-host']
default['openstack']['endpoints']['image-registry']['host'] = node['openstack']['endpoints']['host']

Mark Vanderwiel (vanderwl) wrote :

YangLei, when the bind-host and host are different, it's assuming you have something in place to allow client to connects, like a load balancer or proxy. Is there a use case for having these be different without having a proxy?

YangLei (yanglyy) wrote :

glance-api and glance-registry are distributed on different nodes. bind-host and host will be different in environment.
It seems the current openstack cookbook cannot handle this case. (glance-api and glance-registry in same node)

For proxy:
User can set different IP for bind-host and host in environment:
openstack.endpoints.bind-host = 127.0.0.1 ---> the value will be assigned to bind_host in glance-registry.conf
openstack.endpoints.host = 10.6.1.108 ---> the value will be assigned to registry_host in glance-api.conf

if it happens, glance-api will fail to connect glance-registry.

Anyway, We need make sure that registry_host in glance-api.conf and bind_host in glance-registry.conf always are same.

Change abandoned by Jan Klare (<email address hidden>) on branch: master
Review: https://review.openstack.org/185914
Reason: i think this patch was already abandoned, only negative feedback and no change or response in the last 2 months

Changed in openstack-chef:
status: In Progress → Incomplete
milestone: kilo-rc1 → none
Changed in openstack-chef:
importance: Medium → Undecided
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers