diff --git a/etc/magnum/magnum.conf.sample b/etc/magnum/magnum.conf.sample index 7de4e2effb..e55c28d3a1 100644 --- a/etc/magnum/magnum.conf.sample +++ b/etc/magnum/magnum.conf.sample @@ -35,6 +35,12 @@ # (integer value) #periodic_interval_max = 60 +# Name of this node. This can be an opaque identifier. It is not +# necessarily a hostname, FQDN, or IP address. However, the node name +# must be valid within an AMQP key, and if using ZeroMQ, a valid +# hostname, FQDN, or IP address. (string value) +#host = localhost + # # From oslo.log # diff --git a/magnum/common/rpc.py b/magnum/common/rpc.py index 516567b89f..eeb1dd0348 100644 --- a/magnum/common/rpc.py +++ b/magnum/common/rpc.py @@ -141,7 +141,7 @@ def get_server(target, endpoints, serializer=None): serializer=serializer) -def get_notifier(service=None, host=None, publisher_id=None): +def get_notifier(service='container', host=None, publisher_id=None): assert NOTIFIER is not None if not publisher_id: publisher_id = "%s.%s" % (service, host or CONF.host) diff --git a/magnum/common/service.py b/magnum/common/service.py index 79c7bcd051..d60479ea23 100644 --- a/magnum/common/service.py +++ b/magnum/common/service.py @@ -12,13 +12,31 @@ # See the License for the specific language governing permissions and # limitations under the License. +import socket + from oslo_config import cfg from oslo_log import log as logging +from magnum.common import config +from magnum.i18n import _ + + +service_opts = [ + cfg.StrOpt('host', + default=socket.getfqdn(), + help=_('Name of this node. This can be an opaque identifier. ' + 'It is not necessarily a hostname, FQDN, or IP address. ' + 'However, the node name must be valid within ' + 'an AMQP key, and if using ZeroMQ, a valid ' + 'hostname, FQDN, or IP address.')), +] + +cfg.CONF.register_opts(service_opts) + def prepare_service(argv=None): if argv is None: argv = [] logging.register_options(cfg.CONF) - cfg.CONF(argv[1:], project='magnum') + config.parse_args(argv) logging.setup(cfg.CONF, 'magnum') diff --git a/magnum/opts.py b/magnum/opts.py index 6ada5fb6a0..f2c07d01a7 100644 --- a/magnum/opts.py +++ b/magnum/opts.py @@ -20,6 +20,7 @@ import magnum.api.auth import magnum.common.clients import magnum.common.exception import magnum.common.magnum_keystoneclient +import magnum.common.service import magnum.conductor.config import magnum.conductor.handlers.bay_conductor import magnum.conductor.handlers.docker_conductor @@ -35,7 +36,8 @@ def list_opts(): magnum.common.magnum_keystoneclient.trust_opts, magnum.common.paths.PATH_OPTS, magnum.common.utils.UTILS_OPTS, - magnum.common.rpc_service.periodic_opts + magnum.common.rpc_service.periodic_opts, + magnum.common.service.service_opts, )), ('api', magnum.api.app.API_SERVICE_OPTS), ('bay', magnum.conductor.template_definition.template_def_opts),