[zmq] Don't fallback to topic if wrong server specified

When target is specified with server name the correct
result is empty if there is no records with this precise
name registered.

Change-Id: Ibaa7c23c633ccc5f2ca428deb022c9fc1d00e8e7
This commit is contained in:
ozamiatin 2016-10-19 01:11:36 +03:00 committed by Oleksii Zamiatin
parent 1121a6bb60
commit c9732d5d3b
4 changed files with 7 additions and 9 deletions

View File

@ -70,7 +70,7 @@ class RoutingTableAdaptor(object):
if not self.routing_table.contains(target_key):
LOG.debug("Target %s is not in cache. Check matchmaker server."
% target_key)
hosts = self.matchmaker.get_hosts_fanout_retry(
hosts = self.matchmaker.get_hosts_fanout(
target, zmq_names.socket_type_str(self.listener_type))
LOG.debug("Received hosts %s" % hosts)
self.routing_table.update_hosts(target_key, hosts)
@ -174,9 +174,6 @@ class RoutingTableUpdater(zmq_updater.UpdaterBase):
try:
for target_key in target_keys:
hosts = self.matchmaker.get_hosts_by_key(target_key)
if not hosts:
LOG.warning(_LW("Target %s has been removed") % target_key)
else:
self.routing_table.update_hosts(target_key, hosts)
LOG.debug("Updating routing table from the matchmaker. "
"%d target(s) updated %s." % (len(target_keys),

View File

@ -214,8 +214,7 @@ class MatchmakerRedisBase(zmq_matchmaker_base.MatchmakerBase):
if target.server:
key = zmq_address.target_to_key(target, listener_type)
hosts.extend(self._smembers(key))
if not hosts:
else:
key = zmq_address.prefix_str(target.topic, listener_type)
hosts.extend(self._smembers(key))

View File

@ -34,7 +34,9 @@ def prefix_str(key, listener_type):
def target_to_key(target, listener_type=None):
key = target.topic
if target.server:
key += "/" + target.server
# FIXME(ozamiatin): Workaround for Cinder.
# Remove split when Bug #1630975 is being fixed.
key += "/" + target.server.split('@')[0]
return prefix_str(key, listener_type) if listener_type else key

View File

@ -163,7 +163,7 @@ zmq_opts = [
'after which it is not tracked anymore by a '
'client/server.'),
cfg.BoolOpt('rpc_use_acks', default=True,
cfg.BoolOpt('rpc_use_acks', default=False,
help='Wait for message acknowledgements from receivers. '
'This mechanism works only via proxy without PUB/SUB.'),