From 03a43cb91e55b19c7e66cdd347aaeb5fb0dfe8e2 Mon Sep 17 00:00:00 2001 From: Roy Tang Date: Thu, 16 Apr 2020 21:39:20 -0700 Subject: [PATCH] Add support to set ovs module log level Change-Id: I1fcd5b49cb2af4c76ed32b332f83ca8fa783a3c6 --- .../_neutron-openvswitch-agent-init.sh.tpl | 21 ++++++++++++++++--- neutron/values.yaml | 8 +++++++ .../shared-sriov-ovs-dpdk-bond.yaml | 6 +++++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl index 77c3dee3ec..854acb3e8a 100644 --- a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl +++ b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl @@ -338,6 +338,20 @@ function process_dpdk_bonds { done < "/tmp/bonds_array" } +function set_dpdk_module_log_level { + # loop over all target modules + if [ -n "$(get_dpdk_config_value ${DPDK_CONFIG} '.modules')" ]; then + echo $DPDK_CONFIG | jq -r -c '.modules[]' > /tmp/modules_array + while IFS= read -r module; do + local mod_name=$(get_dpdk_config_value ${module} '.name') + local mod_level=$(get_dpdk_config_value ${module} '.log_level') + + ovs-appctl -t ${OVS_CTL} vlog/set ${mod_name}:${mod_level} + ovs-appctl -t ${OVS_CTL} vlog/list|grep ${mod_name} + done < /tmp/modules_array + fi +} + function get_driver_by_address { if [[ -e /sys/bus/pci/devices/$1/driver ]]; then echo $(ls /sys/bus/pci/devices/$1/driver -al | awk '{n=split($NF,a,"/"); print a[n]}') @@ -393,6 +407,7 @@ if [[ "${DPDK_ENABLED}" == "true" ]]; then init_ovs_dpdk_bridges process_dpdk_nics process_dpdk_bonds + set_dpdk_module_log_level fi # determine local-ip dynamically based on interface provided but only if tunnel_types is not null @@ -420,10 +435,10 @@ EOF if [[ "${bridge_name}" == "${tunnel_interface}" ]]; then # Route the tunnel traffic via the physical bridge if [[ -n "${LOCAL_IP}" && -n "${PREFIX}" ]]; then - if [[ -n $(ovs-appctl ovs/route/show | grep "${LOCAL_IP}") ]]; then - ovs-appctl ovs/route/del "${LOCAL_IP}"/"${PREFIX}" + if [[ -n $(ovs-appctl -t ${OVS_CTL} ovs/route/show | grep "${LOCAL_IP}") ]]; then + ovs-appctl -t ${OVS_CTL} ovs/route/del "${LOCAL_IP}"/"${PREFIX}" fi - ovs-appctl ovs/route/add "${LOCAL_IP}"/"${PREFIX}" "${tunnel_interface}" + ovs-appctl -t ${OVS_CTL} ovs/route/add "${LOCAL_IP}"/"${PREFIX}" "${tunnel_interface}" if [[ -n "${tunnel_underlay_vlan}" ]]; then # If there is not tunnel network gateway, exit diff --git a/neutron/values.yaml b/neutron/values.yaml index afb7de25cb..1cda6dd4e6 100644 --- a/neutron/values.yaml +++ b/neutron/values.yaml @@ -1698,6 +1698,7 @@ conf: ovs-vsctl: CommandFilter, ovs-vsctl, root # NOTE(yamamoto): of_interface=native doesn't use ovs-ofctl ovs-ofctl: CommandFilter, ovs-ofctl, root + ovs-appctl: CommandFilter, ovs-appctl, root kill_ovsdb_client: KillFilter, root, /usr/bin/ovsdb-client, -9 ovsdb-client: CommandFilter, ovsdb-client, root xe: CommandFilter, xe, root @@ -2100,6 +2101,13 @@ conf: # # used with ovs-dpdk. In which case pci_id of PF must be # # provided above. # # vf_index: 0 + # + # Set the log level for each target module (default level is always dbg) + # Supported log levels are: off, emer, err, warn, info, dbg + # + # modules: + # - name: dpdk + # log_level: info # Names of secrets used by bootstrap and environmental checks secrets: diff --git a/neutron/values_overrides/shared-sriov-ovs-dpdk-bond.yaml b/neutron/values_overrides/shared-sriov-ovs-dpdk-bond.yaml index 30d6a2fd53..0754553f26 100644 --- a/neutron/values_overrides/shared-sriov-ovs-dpdk-bond.yaml +++ b/neutron/values_overrides/shared-sriov-ovs-dpdk-bond.yaml @@ -75,6 +75,10 @@ conf: vf_index: 0 bridges: - name: br-phy-bond0 + modules: + - name: dpdk + log_level: info + # In case of shared profile (sriov + ovs-dpdk), sriov agent should finish # first so as to let it configure the SRIOV VFs before ovs-agent tries to # bind it with DPDK driver. @@ -87,4 +91,4 @@ dependencies: - requireSameNode: true labels: application: neutron - component: neutron-sriov-agent \ No newline at end of file + component: neutron-sriov-agent