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
diff --git a/linux/map.jinja b/linux/map.jinja
index 8247837..e60f00d 100644
--- a/linux/map.jinja
+++ b/linux/map.jinja
@@ -177,6 +177,7 @@
         'host': {},
         'mine_dns_records': False,
         'dhclient_config': '/etc/dhcp/dhclient.conf',
+        'ovs_nowait': False,
     },
     'Debian': {
         'pkgs': ['ifenslave'],
@@ -195,6 +196,7 @@
         'host': {},
         'mine_dns_records': False,
         'dhclient_config': '/etc/dhcp/dhclient.conf',
+        'ovs_nowait': False,
     },
     'RedHat': {
         'pkgs': ['iputils'],
@@ -212,6 +214,7 @@
         'host': {},
         'mine_dns_records': False,
         'dhclient_config': '/etc/dhcp/dhclient.conf',
+        'ovs_nowait': False,
     },
 }, grain='os_family', merge=salt['pillar.get']('linux:network')) %}
 
diff --git a/linux/network/dpdk.sls b/linux/network/dpdk.sls
index fb2da30..e16f9c9 100644
--- a/linux/network/dpdk.sls
+++ b/linux/network/dpdk.sls
@@ -64,7 +64,7 @@
 
 linux_network_dpdk_ovs_option_{{ option }}:
   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:
     - service: service_openvswitch
   - require:
@@ -104,14 +104,14 @@
 
 linux_network_dpdk_bond_interface_{{ interface_name }}:
   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 }}"
     - require:
         - cmd: linux_network_dpdk_bridge_interface_{{ interface.bridge }}
 
 linux_network_dpdk_bond_mode_{{ interface_name }}:
   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 }}"
     - require:
         - cmd: linux_network_dpdk_bond_interface_{{ interface_name }}
@@ -120,7 +120,7 @@
 
 linux_network_dpdk_bridge_interface_{{ interface_name }}:
   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 }}"
 
     {# OVS dpdk needs ip address for vxlan termination on bridge br-prv #}
@@ -157,7 +157,7 @@
 
 linux_network_dpdk_bridge_port_interface_{{ interface_name }}:
   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"
     - require:
       - cmd: linux_network_dpdk_bridge_interface_{{ interface.bridge }}
@@ -171,7 +171,7 @@
 
 linux_network_dpdk_bridge_port_interface_n_rxq_{{ interface_name }}:
   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: |
         ovs-vsctl get Interface {{ interface_name }} options | grep 'n_rxq="{{ interface.n_rxq }}"'
 
@@ -181,7 +181,7 @@
 
 linux_network_dpdk_bridge_port_interface_pmd_rxq_affinity_{{ interface_name }}:
   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: |
         ovs-vsctl get Interface {{ interface_name }} other_config | grep 'pmd-rxq-affinity="{{ interface.pmd_rxq_affinity }}"'
 
@@ -192,7 +192,7 @@
 {# MTU ovs dpdk setup on interfaces #}
 linux_network_dpdk_bridge_port_interface_mtu_{{ interface_name }}:
   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 }}"
 
   {%- endif %}
diff --git a/linux/network/interface.sls b/linux/network/interface.sls
index fa37e5e..180f912 100644
--- a/linux/network/interface.sls
+++ b/linux/network/interface.sls
@@ -75,7 +75,7 @@
 add_int_{{ int_name }}_to_ovs_dpdk_bridge_{{ interface_name }}:
   cmd.run:
     - 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 %}
 {%- endfor %}
@@ -102,7 +102,7 @@
 add_int_{{ int_name }}_to_ovs_bridge_{{ interface_name }}:
   cmd.run:
     - 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 %}
 
@@ -125,12 +125,12 @@
 
 ovs_port_set_type_{{ interface_name }}:
   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
 
 ovs_port_set_peer_{{ interface_name }}:
   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 }}
 
 {%- else %}