Petr Horáček has uploaded a new change for review. Change subject: hooks: ovs: add script name to log ......................................................................
hooks: ovs: add script name to log Change-Id: I8e40406fb2dfce6099a2c288b5d3c37ceec839d1 Signed-off-by: Petr Horáček <[email protected]> --- M vdsm_hooks/ovs/ovs_after_get_stats.py M vdsm_hooks/ovs/ovs_after_network_setup.py M vdsm_hooks/ovs/ovs_after_network_setup_failture.py M vdsm_hooks/ovs/ovs_before_network_setup.py M vdsm_hooks/ovs/ovs_before_network_setup_ip.py M vdsm_hooks/ovs/ovs_before_network_setup_ovs.py M vdsm_hooks/ovs/ovs_utils.py 7 files changed, 31 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/16/46916/1 diff --git a/vdsm_hooks/ovs/ovs_after_get_stats.py b/vdsm_hooks/ovs/ovs_after_get_stats.py index fc04417..b902f57 100755 --- a/vdsm_hooks/ovs/ovs_after_get_stats.py +++ b/vdsm_hooks/ovs/ovs_after_get_stats.py @@ -17,13 +17,17 @@ # # Refer to the README and COPYING files for full details of the license # +from functools import partial import traceback from vdsm.netconfpersistence import RunningConfig import hooking -from ovs_utils import is_ovs_network, log +from ovs_utils import is_ovs_network +import ovs_utils + +log = partial(ovs_utils.log, tag='ovs_after_get_stats: ') def ovs_networks_stats(stats): diff --git a/vdsm_hooks/ovs/ovs_after_network_setup.py b/vdsm_hooks/ovs/ovs_after_network_setup.py index 7f99db1..b40e2e6 100644 --- a/vdsm_hooks/ovs/ovs_after_network_setup.py +++ b/vdsm_hooks/ovs/ovs_after_network_setup.py @@ -17,11 +17,15 @@ # # Refer to the README and COPYING files for full details of the license # +from functools import partial import traceback import hooking -from ovs_utils import remove_init_config, log +from ovs_utils import remove_init_config +import ovs_utils + +log = partial(ovs_utils.log, tag='ovs_after_network_setup: ') def main(): diff --git a/vdsm_hooks/ovs/ovs_after_network_setup_failture.py b/vdsm_hooks/ovs/ovs_after_network_setup_failture.py index 9935a13..d79ef84 100755 --- a/vdsm_hooks/ovs/ovs_after_network_setup_failture.py +++ b/vdsm_hooks/ovs/ovs_after_network_setup_failture.py @@ -17,13 +17,16 @@ # # Refer to the README and COPYING files for full details of the license # +from functools import partial import traceback from vdsm import supervdsm import hooking -from ovs_utils import log +import ovs_utils + +log = partial(ovs_utils.log, tag='ovs_after_network_setup_failture: ') def main(): diff --git a/vdsm_hooks/ovs/ovs_before_network_setup.py b/vdsm_hooks/ovs/ovs_before_network_setup.py index c02c438..9bc73a5 100755 --- a/vdsm_hooks/ovs/ovs_before_network_setup.py +++ b/vdsm_hooks/ovs/ovs_before_network_setup.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # from copy import deepcopy +from functools import partial import sys import traceback @@ -28,7 +29,7 @@ from hooking import execCmd import hooking -from ovs_utils import (is_ovs_network, is_ovs_bond, load_init_config, log, +from ovs_utils import (is_ovs_network, is_ovs_bond, load_init_config, save_init_config, iter_ovs_nets, suppress, destroy_ovs_bridge, EXT_IP, EXT_OVS_VSCTL) from ovs_setup_ovs import configure_ovs, prepare_ovs @@ -36,11 +37,14 @@ from ovs_setup_mtu import configure_mtu from ovs_setup_libvirt import (create_libvirt_nets, remove_libvirt_nets, prepare_libvirt) +import ovs_utils # TODO: move required modules into vdsm/lib sys.path.append('/usr/share/vdsm') from network.configurators import libvirt +log = partial(ovs_utils.log, tag='ovs_before_network_setup: ') + def _separate_ovs_nets_bonds(nets, bonds, running_config): """ Get a dictionaries of nets and bonds to be handled by OVS hook and diff --git a/vdsm_hooks/ovs/ovs_before_network_setup_ip.py b/vdsm_hooks/ovs/ovs_before_network_setup_ip.py index c87e6d6..2273cc6 100644 --- a/vdsm_hooks/ovs/ovs_before_network_setup_ip.py +++ b/vdsm_hooks/ovs/ovs_before_network_setup_ip.py @@ -17,11 +17,13 @@ # # Refer to the README and COPYING files for full details of the license # +from functools import partial import sys from vdsm import ipwrapper, sysctl -from ovs_utils import suppress, log, BRIDGE_NAME +from ovs_utils import suppress, BRIDGE_NAME +import ovs_utils # TODO: move required modules into vdsm/lib sys.path.append('/usr/share/vdsm') @@ -30,6 +32,8 @@ from network.models import NetDevice, IPv4, IPv6 from network.sourceroute import DynamicSourceRoute +log = partial(ovs_utils.log, tag='ovs_before_network_setup_ip: ') + iproute2 = Iproute2() diff --git a/vdsm_hooks/ovs/ovs_before_network_setup_ovs.py b/vdsm_hooks/ovs/ovs_before_network_setup_ovs.py index d22748a..72c1c23 100644 --- a/vdsm_hooks/ovs/ovs_before_network_setup_ovs.py +++ b/vdsm_hooks/ovs/ovs_before_network_setup_ovs.py @@ -17,20 +17,24 @@ # # Refer to the README and COPYING files for full details of the license # +from functools import partial import sys from vdsm.netinfo import NetInfo import hooking -from ovs_utils import (get_bond_options, is_ovs_bond, iter_ovs_nets, log, +from ovs_utils import (get_bond_options, is_ovs_bond, iter_ovs_nets, iter_ovs_bonds, rget, suppress, destroy_ovs_bridge, BRIDGE_NAME, EXT_OVS_VSCTL) +import ovs_utils # TODO: move required modules into vdsm/lib sys.path.append('/usr/share/vdsm') from network.configurators import libvirt +log = partial(ovs_utils.log, tag='ovs_before_network_setup_ovs: ') + VALID_MODES = frozenset(['active-backup', 'balance-tcp', 'balance-slb']) VALID_LACP = frozenset(['active', 'passive', 'off']) diff --git a/vdsm_hooks/ovs/ovs_utils.py b/vdsm_hooks/ovs/ovs_utils.py index d592b8f..916909c 100644 --- a/vdsm_hooks/ovs/ovs_utils.py +++ b/vdsm_hooks/ovs/ovs_utils.py @@ -120,8 +120,8 @@ raise Exception('\n'.join(err)) -def log(message): - hooking.log('OVS: %s' % message) +def log(message, tag='OVS: '): + hooking.log('%s%s' % (tag, message)) def load_init_config(): -- To view, visit https://gerrit.ovirt.org/46916 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8e40406fb2dfce6099a2c288b5d3c37ceec839d1 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Petr Horáček <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
