Merge "Log OVS IDL library errors to neutron logs"

changes/85/395185/9
Jenkins 6 years ago committed by Gerrit Code Review
commit 4d7653848d
  1. 2
      neutron/agent/ovsdb/api.py
  2. 7
      neutron/agent/ovsdb/impl_idl.py
  3. 30
      neutron/agent/ovsdb/native/vlog.py

@ -24,7 +24,7 @@ from neutron._i18n import _
interface_map = {
'vsctl': 'neutron.agent.ovsdb.impl_vsctl.OvsdbVsctl',
'native': 'neutron.agent.ovsdb.impl_idl.OvsdbIdl',
'native': 'neutron.agent.ovsdb.impl_idl.NeutronOvsdbIdl',
}
OPTS = [

@ -26,6 +26,7 @@ from neutron.agent.ovsdb import api
from neutron.agent.ovsdb.native import commands as cmd
from neutron.agent.ovsdb.native import connection
from neutron.agent.ovsdb.native import idlutils
from neutron.agent.ovsdb.native import vlog
cfg.CONF.import_opt('ovs_vsctl_timeout', 'neutron.agent.common.ovs_lib')
@ -282,3 +283,9 @@ class OvsdbIdl(api.API):
def list_ifaces(self, bridge):
return cmd.ListIfacesCommand(self, bridge)
class NeutronOvsdbIdl(OvsdbIdl):
def __init__(self, context):
vlog.use_oslo_logger()
super(NeutronOvsdbIdl, self).__init__(context)

@ -0,0 +1,30 @@
# Copyright (c) 2016 Red Hat, Inc.
#
# 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.
from oslo_log import log as logging
from ovs import vlog
LOG = logging.getLogger(__name__)
def use_oslo_logger():
"""Replace the OVS IDL logger functions with our logger"""
# NOTE(twilson) Replace functions directly instead of subclassing so that
# debug messages contain the correct function/filename/line information
vlog.Vlog.emer = LOG.critical
vlog.Vlog.err = LOG.error
vlog.Vlog.warn = LOG.warning
vlog.Vlog.info = LOG.info
vlog.Vlog.dbg = LOG.debug
Loading…
Cancel
Save