Extending txqueuelen param for linux.network
Prod-Related: PROD-35773
Change-Id: I25ac53dfb6080608ee21d8595d59a5fde1dcca9b
diff --git a/README.rst b/README.rst
index c653097..1f6d3d9 100644
--- a/README.rst
+++ b/README.rst
@@ -2197,7 +2197,15 @@
linux:
network:
- tap_custom_txqueuelen: 10000
+ custom_txqueuelen
+ tap:
+ queue_length: 10000
+ enabled: true
+ device_filter: 'tap[0-9a-z\-]*'
+ ten:
+ enabled: false
+ veth:
+ queue_length: 20000
Auto repair/re-attach libvirt's vnet interfaces:
diff --git a/linux/files/60-net-txqueue.rules b/linux/files/60-net-txqueue.rules
index 8f6478c..324391a 100644
--- a/linux/files/60-net-txqueue.rules
+++ b/linux/files/60-net-txqueue.rules
@@ -1 +1,15 @@
+{%- from "linux/map.jinja" import network with context %}
+{%- if network.custom_txqueuelen is defined %}
+{%- for if_name, if_dict in network.custom_txqueuelen.iteritems() %}
+{%- if if_dict.get('enabled', 'true')|string|lower == 'true' %}
+{%- if if_dict.device_filter is defined %}
+{%- set if_dev_filter = if_dict.device_filter %}
+{%- else %}
+{%- set if_dev_filter = if_name + '*' %}
+{%- endif %}
+KERNEL=="{{ if_dev_filter }}", RUN+="/sbin/ip link set %k txqueuelen {{ if_dict.queue_length }}"
+{%- endif %}
+{%- endfor %}
+{%- else %}
KERNEL=="tap[0-9a-z\-]*", RUN+="/sbin/ip link set %k txqueuelen {{ tap_custom_txqueuelen }}"
+{%- endif %}
diff --git a/linux/network/interface.sls b/linux/network/interface.sls
index a7656aa..bad3295 100644
--- a/linux/network/interface.sls
+++ b/linux/network/interface.sls
@@ -515,12 +515,12 @@
{%- endif %}
-{%- if network.tap_custom_txqueuelen is defined %}
+{%- if network.tap_custom_txqueuelen is defined or network.custom_txqueuelen is defined %}
/etc/udev/rules.d/60-net-txqueue.rules:
file.managed:
- source: salt://linux/files/60-net-txqueue.rules
- - mode: 755
+ - mode: 644
- template: jinja
- defaults:
tap_custom_txqueuelen: {{ network.tap_custom_txqueuelen }}