Fix problem when api_host set in config.#183
Conversation
rbd-target-api.py
Outdated
| "summary": ''} | ||
|
|
||
| for gw in gateway_list: | ||
| if gw == "localhost" |
There was a problem hiding this comment.
Need a ":" at the end of the line.
if gw == "localhost":
There was a problem hiding this comment.
One question just to make sure I understood the localhost check. Is it for cases like rbd-target-api:clientauth():
gateways.insert(0, 'localhost')
The check you are adding allows callers to just use localhost instead of doing
gateways.insert(0, settings.config.api_host)
right?
There was a problem hiding this comment.
One question just to make sure I understood the localhost check. Is it for cases like rbd-target-api:clientauth():
gateways.insert(0, 'localhost')
The check you are adding allows callers to just use localhost instead of doinggateways.insert(0, settings.config.api_host)
right?
yes ,that's what I thought.
rbd-target-api.py
Outdated
| logger.debug("gateway update order is {}".format(','.join(gateway_list))) | ||
|
|
||
| for gw in gateway_list: | ||
| if gw == "localhost" |
| "api_host": StrSetting("api_host", "localhost"), | ||
| "api_port": IntSetting("api_port", 1, 65535, 5000), | ||
| "api_secure": BoolSetting("api_secure", True), | ||
| "api_ssl_verify": BoolSetting("api_ssl_verify", False), |
There was a problem hiding this comment.
You will need to add api_host to exclude_from_hash in ceph_iscsi_config/setting.py, because that value can be different on each node.
75b7fb4 to
acaf08a
Compare
|
@mikechristie |
ceph_iscsi_config/gateway_setting.py
Outdated
| "api_host": StrSetting("api_host", "::"), | ||
| # if the api_host has a colon, you must wrap it with square brackets. | ||
| # i.e:[::] | ||
| "api_host": StrSetting("api_host", "localhost"), |
There was a problem hiding this comment.
Hey
Sorry for the delay on this, but I just can't get it to work and I'm not sure if its my setup or the patch.
- If I use the defaults set in the patch, and I do not override anything, then I get "Connection refused" errors when trying to do any command to the the daemon.
Does using the default values work for you? If so, when yo do:
ping localhost
do you see localhost resolving to ::1 or 127.0.1.
-
If you use "[::]" like documented in the code comments above, then rbd-target-api crashes.
-
If I use "::" as the default above or in iscsi-gateway.cfg for the api_host value it works ok for me then.
There was a problem hiding this comment.
Hey
Sorry for the delay on this, but I just can't get it to work and I'm not sure if its my setup or the patch.
1. If I use the defaults set in the patch, and I do not override anything, then I get "Connection refused" errors when trying to do any command to the the daemon.Does using the default values work for you? If so, when yo do:
ping localhost
do you see localhost resolving to ::1 or 127.0.1.
It is better to use ip such as the host name, because there is no mapping configured for localhost。
If localhost host mapping is configured on /etc/hosts, there should be no problem。
ie:/etc/hosts
[root@ceph ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@ceph ~]# ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.014 ms
^C
--- localhost ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.014/0.014/0.014/0.000 ms
[root@ceph ~]#
1. If you use "[::]" like documented in the code comments above, then rbd-target-api crashes.
2. If I use "::" as the default above or in iscsi-gateway.cfg for the api_host value it works ok for me then.
flask does not support IP that contain [and] characters,so i change it
...........
app.run(host=settings.config.api_host.strip('[').strip(']'),
.........
I test it,rbd-target-api and gwcli ,it works for me
acaf08a to
4cf0dda
Compare
when api_host is config ,command gwcli may be hold.