File: config.py

package info (click to toggle)
networking-mlnx 1%3A13.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 704 kB
  • sloc: python: 4,863; sh: 180; makefile: 36
file content (60 lines) | stat: -rw-r--r-- 2,026 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright 2013 Mellanox Technologies, Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

from networking_mlnx._i18n import _LI
from oslo_config import cfg
from oslo_log import log as logging

LOG = logging.getLogger(__name__)
DEFAULT_INTERFACE_MAPPINGS = []

mlx_daemon_opts = [
    cfg.StrOpt('socket_os_transport', default="tcp"),
    cfg.StrOpt('socket_os_port', default="60001"),
    cfg.StrOpt('socket_os_addr', default="0.0.0.0"),
    cfg.ListOpt('fabrics',
                default=DEFAULT_INTERFACE_MAPPINGS,
                help=("List of <physical_network>:<physical_interface>")),
    cfg.IntOpt('default_timeout',
               default=5000,
               help=('Default timeout waiting for messages')),
    cfg.IntOpt('max_polling_count',
               default=5,
               help=('Daemon will do sync after max_polling_count '
                     '* default_timeout')),
    cfg.StrOpt('rootwrap_conf',
               default='/etc/neutron/rootwrap.conf',
               help=('rootwrap configuration file'))
]


cfg.CONF.register_opts(mlx_daemon_opts, "DAEMON")
logging.register_options(cfg.CONF)


def init(args, **kwargs):
    cfg.CONF(args=args, project='eswitchd',
             **kwargs)


def setup_logging():
    """Sets up the logging options for a log with supplied name."""
    logging.setup(cfg.CONF, 'eswitchd')
    LOG.info(_LI("Logging enabled!"))
    LOG.info(_LI("%(prog)s Started!"),
             {'prog': sys.argv[0]})
    LOG.debug("command line: %s", " ".join(sys.argv))