Using config option to bind to etcd server

In OPNFV Apex deployments, the etcd server listens only at a
specific host IP address, not localhost. As a result, the Gluon
plugin cannot talk to etcd in such deployments.

This fix (mis-)uses the Neutron bind_host configuration option
to allow the Gluon ML2 plugin wrapper to idenify the IP etcd
is listening on. This should be replaced by a proper config
option later on.

Change-Id: Ib9d958c267d0364889e1213f9fc7c93b4fd04d89
Signed-off-by: Georg Kunz <georg.kunz@ericsson.com>
This commit is contained in:
Georg Kunz 2017-02-13 17:28:49 +01:00
parent abe3b0836d
commit ade1ed78e2
1 changed files with 8 additions and 2 deletions

View File

@ -17,6 +17,7 @@ import etcd
import json
import os
from oslo_config import cfg
from oslo_log import helpers as log_helpers
from oslo_log import log
@ -27,9 +28,14 @@ from neutron.plugins.ml2.plugin import Ml2Plugin
class MyData(object):
pass
CONF = cfg.CONF
PluginData = MyData()
PluginData.etcd_port = 2379
PluginData.etcd_host = '127.0.0.1'
if CONF.bind_host == '0.0.0.0':
PluginData.etcd_host = '127.0.0.1'
else:
PluginData.etcd_host = CONF.bind_host
PluginData.gluon_base = "/gluon/port"
PluginData.proton_port = 2704
PluginData.proton_host = '127.0.0.1'
@ -65,7 +71,7 @@ class GluonPlugin(Ml2Plugin):
LOG.error(
"Cannot connect to etcd, make sure that etcd is running.")
except Exception as e:
LOG.error("Unkown exception:", str(e))
LOG.error("Unknown exception:", str(e))
return None
@log_helpers.log_method_call