Update nova-rpc-zmq-receiver to load nova.conf.

Updates the bin/nova-rpc-zmq-receiver so that it makes use of FLAGS,
calls parse_args, and loads the nova.conf config file like all
other nova- binaries.

Fixes LP Bug #1044153

Change-Id: I904e5d2ae491cd805be78038493d437dd1f7f3cc
This commit is contained in:
Dan Prince 2012-08-30 21:23:07 -04:00
parent ca38cba242
commit 4aaf02e207

View File

@ -33,22 +33,23 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'nova', '__init__.py')):
sys.path.insert(0, POSSIBLE_TOPDIR)
from nova import exception
from nova.openstack.common import cfg
from nova import flags
from nova.openstack.common import log as logging
from nova.openstack.common import rpc
from nova.openstack.common.rpc import impl_zmq
from nova import utils
CONF = cfg.CONF
FLAGS = flags.FLAGS
FLAGS.register_opts(rpc.rpc_opts)
def main():
CONF.register_opts(rpc.rpc_opts)
impl_zmq.register_opts(CONF)
flags.parse_args(sys.argv)
impl_zmq.register_opts(FLAGS)
logging.setup("nova")
utils.monkey_patch()
ipc_dir = CONF.rpc_zmq_ipc_dir
ipc_dir = FLAGS.rpc_zmq_ipc_dir
# Create the necessary directories/files for this service.
if not os.path.isdir(ipc_dir):
@ -61,10 +62,10 @@ def main():
logging.error(_("Could not create IPC socket directory."))
return
with contextlib.closing(impl_zmq.ZmqProxy(CONF)) as reactor:
with contextlib.closing(impl_zmq.ZmqProxy(FLAGS)) as reactor:
consume_in = "tcp://%s:%s" % \
(CONF.rpc_zmq_bind_address,
CONF.rpc_zmq_port)
(FLAGS.rpc_zmq_bind_address,
FLAGS.rpc_zmq_port)
consumption_proxy = impl_zmq.InternalContext(None)
reactor.register(consumption_proxy,