Browse Source

Nonblocking ovs-vsctl calls

Issue: First time you configure dpdk ovs switch it would stuck on
       answering salt-minion because kernel options, such as
       intel_iommu,iommu,isolcpus, are not set and ovs would
       exhaust all hugepages and fail to apply options on the fly.

Fix:   Configure ovs switch without waiting for an answer and
       reboot the node afterall as we do this all the time before
       starting automated pipeline.

Change-Id: Ica27a6cc47312bcc0762cddde049a0abf771f9fb
pull/148/merge
Dzmitry Stremkouski 6 years ago
parent
commit
0419747a07
3 changed files with 15 additions and 12 deletions
  1. +3
    -0
      linux/map.jinja
  2. +8
    -8
      linux/network/dpdk.sls
  3. +4
    -4
      linux/network/interface.sls

+ 3
- 0
linux/map.jinja View File

'host': {}, 'host': {},
'mine_dns_records': False, 'mine_dns_records': False,
'dhclient_config': '/etc/dhcp/dhclient.conf', 'dhclient_config': '/etc/dhcp/dhclient.conf',
'ovs_nowait': False,
}, },
'Debian': { 'Debian': {
'pkgs': ['ifenslave'], 'pkgs': ['ifenslave'],
'host': {}, 'host': {},
'mine_dns_records': False, 'mine_dns_records': False,
'dhclient_config': '/etc/dhcp/dhclient.conf', 'dhclient_config': '/etc/dhcp/dhclient.conf',
'ovs_nowait': False,
}, },
'RedHat': { 'RedHat': {
'pkgs': ['iputils'], 'pkgs': ['iputils'],
'host': {}, 'host': {},
'mine_dns_records': False, 'mine_dns_records': False,
'dhclient_config': '/etc/dhcp/dhclient.conf', 'dhclient_config': '/etc/dhcp/dhclient.conf',
'ovs_nowait': False,
}, },
}, grain='os_family', merge=salt['pillar.get']('linux:network')) %} }, grain='os_family', merge=salt['pillar.get']('linux:network')) %}



+ 8
- 8
linux/network/dpdk.sls View File



linux_network_dpdk_ovs_option_{{ option }}: linux_network_dpdk_ovs_option_{{ option }}:
cmd.run: cmd.run:
- name: 'ovs-vsctl set Open_vSwitch . other_config:{{ option }}'
- name: 'ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} set Open_vSwitch . other_config:{{ option }}'
- watch_in: - watch_in:
- service: service_openvswitch - service: service_openvswitch
- require: - require:


linux_network_dpdk_bond_interface_{{ interface_name }}: linux_network_dpdk_bond_interface_{{ interface_name }}:
cmd.run: cmd.run:
- name: "ovs-vsctl add-bond {{ interface.bridge }} {{ interface_name }} {{ bond_interfaces.keys()|join(' ') }} {% for iface_name, iface in bond_interfaces.items() %}-- set Interface {{ iface_name }} type=dpdk options:dpdk-devargs={{ iface.pci }} {% endfor %}"
- name: "ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} add-bond {{ interface.bridge }} {{ interface_name }} {{ bond_interfaces.keys()|join(' ') }} {% for iface_name, iface in bond_interfaces.items() %}-- set Interface {{ iface_name }} type=dpdk options:dpdk-devargs={{ iface.pci }} {% endfor %}"
- unless: "ovs-vsctl show | grep {{ interface_name }}" - unless: "ovs-vsctl show | grep {{ interface_name }}"
- require: - require:
- cmd: linux_network_dpdk_bridge_interface_{{ interface.bridge }} - cmd: linux_network_dpdk_bridge_interface_{{ interface.bridge }}


linux_network_dpdk_bond_mode_{{ interface_name }}: linux_network_dpdk_bond_mode_{{ interface_name }}:
cmd.run: cmd.run:
- name: "ovs-vsctl set port {{ interface_name }} bond_mode={{ interface.mode }}{%- if interface.mode == 'balance-slb' %} lacp=active{%- endif %}"
- name: "ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} set port {{ interface_name }} bond_mode={{ interface.mode }}{%- if interface.mode == 'balance-slb' %} lacp=active{%- endif %}"
- unless: "ovs-appctl bond/show {{ interface_name }} | grep {{ interface.mode }}" - unless: "ovs-appctl bond/show {{ interface_name }} | grep {{ interface.mode }}"
- require: - require:
- cmd: linux_network_dpdk_bond_interface_{{ interface_name }} - cmd: linux_network_dpdk_bond_interface_{{ interface_name }}


linux_network_dpdk_bridge_interface_{{ interface_name }}: linux_network_dpdk_bridge_interface_{{ interface_name }}:
cmd.run: cmd.run:
- name: "ovs-vsctl add-br {{ interface_name }} -- set bridge {{ interface_name }} datapath_type=netdev{% if interface.tag is defined %} -- set port {{ interface_name }} tag={{ interface.tag }}{% endif %}"
- name: "ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} add-br {{ interface_name }} -- set bridge {{ interface_name }} datapath_type=netdev{% if interface.tag is defined %} -- set port {{ interface_name }} tag={{ interface.tag }}{% endif %}"
- unless: "ovs-vsctl show | grep {{ interface_name }}" - unless: "ovs-vsctl show | grep {{ interface_name }}"


{# OVS dpdk needs ip address for vxlan termination on bridge br-prv #} {# OVS dpdk needs ip address for vxlan termination on bridge br-prv #}


linux_network_dpdk_bridge_port_interface_{{ interface_name }}: linux_network_dpdk_bridge_port_interface_{{ interface_name }}:
cmd.run: cmd.run:
- name: "ovs-vsctl add-port {{ interface.bridge }} dpdk0 -- set Interface dpdk0 type=dpdk options:dpdk-devargs={{ interface.pci }}"
- name: "ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} add-port {{ interface.bridge }} dpdk0 -- set Interface dpdk0 type=dpdk options:dpdk-devargs={{ interface.pci }}"
- unless: "ovs-vsctl show | grep dpdk0" - unless: "ovs-vsctl show | grep dpdk0"
- require: - require:
- cmd: linux_network_dpdk_bridge_interface_{{ interface.bridge }} - cmd: linux_network_dpdk_bridge_interface_{{ interface.bridge }}


linux_network_dpdk_bridge_port_interface_n_rxq_{{ interface_name }}: linux_network_dpdk_bridge_port_interface_n_rxq_{{ interface_name }}:
cmd.run: cmd.run:
- name: "ovs-vsctl set Interface {{ interface_name }} options:n_rxq={{ interface.n_rxq }} "
- name: "ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} set Interface {{ interface_name }} options:n_rxq={{ interface.n_rxq }} "
- unless: | - unless: |
ovs-vsctl get Interface {{ interface_name }} options | grep 'n_rxq="{{ interface.n_rxq }}"' ovs-vsctl get Interface {{ interface_name }} options | grep 'n_rxq="{{ interface.n_rxq }}"'




linux_network_dpdk_bridge_port_interface_pmd_rxq_affinity_{{ interface_name }}: linux_network_dpdk_bridge_port_interface_pmd_rxq_affinity_{{ interface_name }}:
cmd.run: cmd.run:
- name: "ovs-vsctl set Interface {{ interface_name }} other_config:pmd-rxq-affinity={{ interface.pmd_rxq_affinity }} "
- name: "ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} set Interface {{ interface_name }} other_config:pmd-rxq-affinity={{ interface.pmd_rxq_affinity }} "
- unless: | - unless: |
ovs-vsctl get Interface {{ interface_name }} other_config | grep 'pmd-rxq-affinity="{{ interface.pmd_rxq_affinity }}"' ovs-vsctl get Interface {{ interface_name }} other_config | grep 'pmd-rxq-affinity="{{ interface.pmd_rxq_affinity }}"'


{# MTU ovs dpdk setup on interfaces #} {# MTU ovs dpdk setup on interfaces #}
linux_network_dpdk_bridge_port_interface_mtu_{{ interface_name }}: linux_network_dpdk_bridge_port_interface_mtu_{{ interface_name }}:
cmd.run: cmd.run:
- name: "ovs-vsctl set Interface {{ interface_name }} mtu_request={{ interface.mtu }} "
- name: "ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} set Interface {{ interface_name }} mtu_request={{ interface.mtu }} "
- unless: "ovs-vsctl get Interface {{ interface_name }} mtu_request | grep {{ interface.mtu }}" - unless: "ovs-vsctl get Interface {{ interface_name }} mtu_request | grep {{ interface.mtu }}"


{%- endif %} {%- endif %}

+ 4
- 4
linux/network/interface.sls View File

add_int_{{ int_name }}_to_ovs_dpdk_bridge_{{ interface_name }}: add_int_{{ int_name }}_to_ovs_dpdk_bridge_{{ interface_name }}:
cmd.run: cmd.run:
- unless: ovs-vsctl show | grep -w {{ int_name }} - unless: ovs-vsctl show | grep -w {{ int_name }}
- name: ovs-vsctl add-port {{ interface_name }} {{ int_name }}
- name: ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} add-port {{ interface_name }} {{ int_name }}


{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
add_int_{{ int_name }}_to_ovs_bridge_{{ interface_name }}: add_int_{{ int_name }}_to_ovs_bridge_{{ interface_name }}:
cmd.run: cmd.run:
- unless: ovs-vsctl show | grep {{ int_name }} - unless: ovs-vsctl show | grep {{ int_name }}
- name: ovs-vsctl add-port {{ interface_name }} {{ int_name }}
- name: ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} add-port {{ interface_name }} {{ int_name }}


{%- endif %} {%- endif %}




ovs_port_set_type_{{ interface_name }}: ovs_port_set_type_{{ interface_name }}:
cmd.run: cmd.run:
- name: ovs-vsctl set interface {{ interface_name }} type=patch
- name: ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} set interface {{ interface_name }} type=patch
- unless: ovs-vsctl show | grep -A 1 'Interface {{ interface_name }}' | grep patch - unless: ovs-vsctl show | grep -A 1 'Interface {{ interface_name }}' | grep patch


ovs_port_set_peer_{{ interface_name }}: ovs_port_set_peer_{{ interface_name }}:
cmd.run: cmd.run:
- name: ovs-vsctl set interface {{ interface_name }} options:peer={{ interface.peer }}
- name: ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} set interface {{ interface_name }} options:peer={{ interface.peer }}
- unless: ovs-vsctl show | grep -A 2 'Interface {{ interface_name }}' | grep {{ interface.peer }} - unless: ovs-vsctl show | grep -A 2 'Interface {{ interface_name }}' | grep {{ interface.peer }}


{%- else %} {%- else %}

Loading…
Cancel
Save