From 44beb84b48051ff374bde6088688d6759a1807eb Mon Sep 17 00:00:00 2001 From: Jason Kölker Date: Tue, 10 Jul 2012 11:12:50 -0500 Subject: Fix Zmq so it doesn't rely on nova flags * Embeded newlines in logging makes me cry * String formatting uses parens not curly braces * Fix LP1023039 * Hard skip Zmq tests so jenkins passes. Someone will have to fix. Change-Id: I9b12ac47b02edf1d8dba7236550deb8ee33f5e07 --- openstack/common/rpc/impl_zmq.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'openstack/common') diff --git a/openstack/common/rpc/impl_zmq.py b/openstack/common/rpc/impl_zmq.py index 3eefa96..77723ca 100644 --- a/openstack/common/rpc/impl_zmq.py +++ b/openstack/common/rpc/impl_zmq.py @@ -15,6 +15,7 @@ # under the License. import pprint +import socket import string import sys import types @@ -59,6 +60,9 @@ zmq_opts = [ cfg.StrOpt('rpc_zmq_ipc_dir', default='/var/run/openstack', help='Directory for holding IPC sockets'), + cfg.StrOpt('rpc_zmq_host', default=socket.gethostname(), + help='Name of this node. Must be a valid hostname, FQDN, or ' + 'IP address') ] @@ -119,11 +123,12 @@ class ZmqSocket(object): for f in do_sub: self.subscribe(f) - LOG.debug(_("Connecting to %{addr}s with %{type}s" - "\n-> Subscribed to %{subscribe}s" - "\n-> bind: %{bind}s"), - {'addr': addr, 'type': self.socket_s(), - 'subscribe': subscribe, 'bind': bind}) + str_data = {'addr': addr, 'type': self.socket_s(), + 'subscribe': subscribe, 'bind': bind} + + LOG.debug(_("Connecting to %(addr)s with %(type)s"), str_data) + LOG.debug(_("-> Subscribed to %(subscribe)s"), str_data) + LOG.debug(_("-> bind: %(bind)s"), str_data) try: if bind: @@ -542,8 +547,7 @@ def _call(addr, context, msg_id, topic, msg, timeout=None): msg_id = str(uuid.uuid4().hex) # Replies always come into the reply service. - # We require that FLAGS.host is a FQDN, IP, or resolvable hostname. - reply_topic = "zmq_replies.%s" % FLAGS.host + reply_topic = "zmq_replies.%s" % FLAGS.rpc_zmq_host LOG.debug(_("Creating payload")) # Curry the original request into a reply method. -- cgit