diff --git a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl index ce8247327a..0b476724a1 100644 --- a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl +++ b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl @@ -329,9 +329,27 @@ function process_dpdk_bonds { fi done < /tmp/nics_array - ovs-vsctl --db=unix:${OVS_SOCKET} --may-exist add-bond "${dpdk_bridge}" "${bond_name}" \ - ${nic_name_str} \ - "${ovs_options}" ${dev_args_str} + if [ "${UPDATE_DPDK_BOND_CONFIG}" == "true" ]; then + echo -e "NOTE: UPDATE_DPDK_BOND_CONFIG is set to true.\ + \nThis might cause disruptions in ovs traffic.\ + \nTo avoid this disruption set UPDATE_DPDK_BOND_CONFIG to false." + ovs-vsctl --db=unix:${OVS_SOCKET} set Bridge "${dpdk_bridge}" other_config:update_config=true + ovs_update_config=true + else + ovs_update_config=$(ovs-vsctl --columns=other_config --no-heading -d json list bridge "${dpdk_bridge}" \ + | jq -r '.[1][] as $list | if $list[0] == "update_config" then $list[1] else empty end') + fi + + + if [ "${ovs_update_config}" == "true" ] || [ "${ovs_update_config}" == "" ]; + then + ovs-vsctl --db=unix:${OVS_SOCKET} --if-exists del-port "${bond_name}" + ovs-vsctl --db=unix:${OVS_SOCKET} set Bridge "${dpdk_bridge}" other_config:update_config=false + ovs-vsctl --db=unix:${OVS_SOCKET} --may-exist add-bond "${dpdk_bridge}" "${bond_name}" \ + ${nic_name_str} \ + "${ovs_options}" ${dev_args_str} + fi + done < "/tmp/bonds_array" } diff --git a/neutron/templates/configmap-etc.yaml b/neutron/templates/configmap-etc.yaml index b888fc820d..ec1aa68467 100644 --- a/neutron/templates/configmap-etc.yaml +++ b/neutron/templates/configmap-etc.yaml @@ -277,6 +277,7 @@ data: rootwrap.conf: {{ $envAll.Values.conf.rootwrap | b64enc }} auto_bridge_add: {{ toJson $envAll.Values.conf.auto_bridge_add | b64enc }} dpdk.conf: {{ toJson $envAll.Values.conf.ovs_dpdk | b64enc }} + update_dpdk_bond_config: {{ $envAll.Values.conf.ovs_dpdk.update_dpdk_bond_config | toString | b64enc }} {{- if .Values.manifests.certificates }} {{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.mpm_event "key" "mpm_event.conf" "format" "Secret" ) | indent 2 }} {{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.wsgi_neutron_server "key" "wsgi-server.conf" "format" "Secret" ) | indent 2 }} diff --git a/neutron/templates/daemonset-ovs-agent.yaml b/neutron/templates/daemonset-ovs-agent.yaml index 05ee00630e..b33cb0ef9e 100644 --- a/neutron/templates/daemonset-ovs-agent.yaml +++ b/neutron/templates/daemonset-ovs-agent.yaml @@ -104,6 +104,14 @@ spec: {{ tuple $envAll "neutron_openvswitch_agent" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.agent.ovs | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ dict "envAll" $envAll "application" "neutron_ovs_agent" "container" "neutron_ovs_agent_init" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} + {{- if .Values.conf.ovs_dpdk.enabled }} + env: + - name: UPDATE_DPDK_BOND_CONFIG + valueFrom: + secretKeyRef: + name: neutron-ovs-agent-default + key: update_dpdk_bond_config + {{- end }} command: - /tmp/neutron-openvswitch-agent-init.sh volumeMounts: diff --git a/neutron/values.yaml b/neutron/values.yaml index e4aba783f8..78c6d4ee78 100644 --- a/neutron/values.yaml +++ b/neutron/values.yaml @@ -2105,6 +2105,12 @@ conf: # because additional parameters are needed ovs_dpdk: enabled: false + # setting update_dpdk_bond_config to true will have default behavior, + # which may cause disruptions in ovs dpdk traffic in case of neutron + # ovs agent restart or when dpdk nic/bond configurations are changed. + # Setting this to false will configure dpdk in the first run and + # disable nic/bond config on event of restart or config update. + update_dpdk_bond_config: true driver: uio_pci_generic # In case bonds are configured, the nics which are part of those bonds # must NOT be provided here.