Merge pull request #58 from salt-formulas/pr_fix_hostname_template
remove trailing line, causing every deployment to update the file and…
diff --git a/README.rst b/README.rst
index 026e2a2..28619e0 100644
--- a/README.rst
+++ b/README.rst
@@ -217,6 +217,49 @@
cpu:
governor: performance
+Huge Pages
+~~~~~~~~~~~~
+
+Huge Pages give a performance boost to applications that intensively deal
+with memory allocation/deallocation by decreasing memory fragmentation.
+
+.. code-block:: yaml
+
+ linux:
+ system:
+ kernel:
+ hugepages:
+ small:
+ size: 2M
+ count: 107520
+ mount_point: /mnt/hugepages_2MB
+ mount: false/true # default false
+ large:
+ default: true # default automatically mounted
+ size: 1G
+ count: 210
+ mount_point: /mnt/hugepages_1GB
+
+Note: not recommended to use both pagesizes in concurrently.
+
+Intel SR-IOV
+~~~~~~~~~~~~
+
+PCI-SIG Single Root I/O Virtualization and Sharing (SR-IOV) specification defines a standardized mechanism to virtualize PCIe devices. The mechanism can virtualize a single PCIe Ethernet controller to appear as multiple PCIe devices.
+
+.. code-block:: yaml
+
+ linux:
+ system:
+ kernel:
+ sriov: True
+ unsafe_interrupts: False # Default is false. for older platforms and AMD we need to add interrupt remapping workaround
+ rc:
+ local: |
+ #!/bin/sh -e
+ # Enable 7 VF on eth1
+ echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
+ exit 0
Repositories
diff --git a/linux/files/grub_hugepages b/linux/files/grub_hugepages
new file mode 100644
index 0000000..509cc11
--- /dev/null
+++ b/linux/files/grub_hugepages
@@ -0,0 +1,2 @@
+{%- from "linux/map.jinja" import system with context %}
+GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT {%- for hugepages_type, hugepages in system.kernel.hugepages.iteritems() %}{%- if hugepages.get('default', False) %} default_hugepagesz={{ hugepages.size }} {%- endif %} hugepagesz={{ hugepages.size }} hugepages={{ hugepages.count }} {%- endfor %}"
diff --git a/linux/network/hostname.sls b/linux/network/hostname.sls
index 7c1594a..99de653 100644
--- a/linux/network/hostname.sls
+++ b/linux/network/hostname.sls
@@ -19,6 +19,7 @@
linux_enforce_hostname:
cmd.wait:
- name: hostname {{ network.hostname }}
+ - unless: test "$(hostname)" = "{{ network.hostname }}"
{#
linux_hostname_hosts:
@@ -29,4 +30,4 @@
- {{ network.hostname }}
#}
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/linux/network/interface.sls b/linux/network/interface.sls
index 0fda106..f42cc53 100644
--- a/linux/network/interface.sls
+++ b/linux/network/interface.sls
@@ -13,9 +13,9 @@
linux_network_bridge_pkgs:
pkg.installed:
{%- if network.bridge == 'openvswitch' %}
- - names: {{ network.ovs_pkgs }}
+ - pkgs: {{ network.ovs_pkgs }}
{%- else %}
- - names: {{ network.bridge_pkgs }}
+ - pkgs: {{ network.bridge_pkgs }}
{%- endif %}
{%- endif %}
@@ -212,7 +212,7 @@
linux_network_packages:
pkg.installed:
- - names: {{ network.pkgs }}
+ - pkgs: {{ network.pkgs }}
/etc/netctl/network_{{ interface.wireless.essid }}:
file.managed:
diff --git a/linux/storage/lvm.sls b/linux/storage/lvm.sls
index 13f0e84..0126e32 100644
--- a/linux/storage/lvm.sls
+++ b/linux/storage/lvm.sls
@@ -4,7 +4,7 @@
linux_lvm_pkgs:
pkg.installed:
- - names: {{ storage.lvm_pkgs }}
+ - pkgs: {{ storage.lvm_pkgs }}
{%- for vgname, vg in storage.lvm.iteritems() %}
diff --git a/linux/storage/multipath.sls b/linux/storage/multipath.sls
index 6bcadd1..dc59d9f 100644
--- a/linux/storage/multipath.sls
+++ b/linux/storage/multipath.sls
@@ -3,7 +3,7 @@
linux_storage_multipath_packages:
pkg.installed:
- - names: {{ storage.multipath.pkgs }}
+ - pkgs: {{ storage.multipath.pkgs }}
linux_storage_multipath_config:
file.managed:
diff --git a/linux/system/doc.sls b/linux/system/doc.sls
index f499516..64c9d0a 100644
--- a/linux/system/doc.sls
+++ b/linux/system/doc.sls
@@ -19,7 +19,7 @@
linux_system_doc_validity_check:
pkg.installed:
- - names: {{ system.doc_validity_pkgs }}
+ - pkgs: {{ system.doc_validity_pkgs }}
cmd.wait:
- name: python -c "import yaml; stream = file('/etc/salt/grains.d/sphinx', 'r'); yaml.load(stream); stream.close()"
- require:
diff --git a/linux/system/grub.sls b/linux/system/grub.sls
new file mode 100644
index 0000000..d36ba47
--- /dev/null
+++ b/linux/system/grub.sls
@@ -0,0 +1,11 @@
+grub_d_directory:
+ file.directory:
+ - name: /etc/default/grub.d
+ - user: root
+ - group: root
+ - mode: 755
+ - makedirs: True
+
+grub_update:
+ cmd.wait:
+ - name: update-grub
diff --git a/linux/system/hugepages.sls b/linux/system/hugepages.sls
new file mode 100644
index 0000000..342d401
--- /dev/null
+++ b/linux/system/hugepages.sls
@@ -0,0 +1,33 @@
+{%- from "linux/map.jinja" import system with context %}
+
+include:
+ - linux.system.grub
+
+{%- if "pse" in grains.cpu_flags or "pdpe1gb" in grains.cpu_flags %}
+
+/etc/default/grub.d/90-hugepages.cfg:
+ file.managed:
+ - source: salt://linux/files/grub_hugepages
+ - template: jinja
+ - require:
+ - file: grub_d_directory
+ - watch_in:
+ - cmd: grub_update
+
+{%- for hugepages_type, hugepages in system.kernel.hugepages.iteritems() %}
+
+{%- if hugepages.get('mount', False) or hugepages.get('default', False) %}
+
+hugepages_mount_{{ hugepages_type }}:
+ mount.mounted:
+ - name: {{ hugepages.mount_point }}
+ - device: Hugetlbfs-kvm
+ - fstype: hugetlbfs
+ - mkmnt: true
+ - opts: mode=775,pagesize={{ hugepages.size }}
+
+{%- endif %}
+
+{%- endfor %}
+
+{%- endif %}
diff --git a/linux/system/init.sls b/linux/system/init.sls
index fabc37e..fb1b34d 100644
--- a/linux/system/init.sls
+++ b/linux/system/init.sls
@@ -11,6 +11,12 @@
{%- endif %}
{%- if system.kernel is defined %}
- linux.system.kernel
+{%- if system.kernel.hugepages is defined %}
+- linux.system.hugepages
+{%- endif %}
+{%- if system.kernel.sriov is defined %}
+- linux.system.sriov
+{%- endif %}
{%- endif %}
{%- if system.cpu is defined %}
- linux.system.cpu
@@ -65,4 +71,4 @@
{%- endif %}
{%- if system.config is defined %}
- linux.system.config
-{%- endif %}
+{%- endif %}
\ No newline at end of file
diff --git a/linux/system/kernel.sls b/linux/system/kernel.sls
index d1ebb9f..035f1e0 100644
--- a/linux/system/kernel.sls
+++ b/linux/system/kernel.sls
@@ -7,7 +7,7 @@
linux_kernel_package:
pkg.installed:
- - names:
+ - pkgs:
- linux-image-{{ system.kernel.version }}-{{ system.kernel.type|default('generic') }}
{%- if system.kernel.get('headers', False) %}
- linux-headers-{{ system.kernel.version }}-{{ system.kernel.type|default('generic') }}
diff --git a/linux/system/package.sls b/linux/system/package.sls
index f4cd07e..9bda3a2 100644
--- a/linux/system/package.sls
+++ b/linux/system/package.sls
@@ -3,7 +3,7 @@
linux_packages:
pkg.installed:
- - names: {{ system.pkgs }}
+ - pkgs: {{ system.pkgs }}
{%- for name, package in system.package.iteritems() %}
diff --git a/linux/system/selinux.sls b/linux/system/selinux.sls
index a91ed2e..d9cba32 100644
--- a/linux/system/selinux.sls
+++ b/linux/system/selinux.sls
@@ -27,4 +27,4 @@
{%- endif %}
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/linux/system/sriov.sls b/linux/system/sriov.sls
new file mode 100644
index 0000000..4421c67
--- /dev/null
+++ b/linux/system/sriov.sls
@@ -0,0 +1,27 @@
+{%- from "linux/map.jinja" import system with context %}
+
+include:
+ - linux.system.grub
+
+/etc/default/grub.d/90-sriov.cfg:
+ file.managed:
+ - contents: 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT intel_iommu=on iommu=pt"'
+ - require:
+ - file: grub_d_directory
+ - watch_in:
+ - cmd: grub_update
+
+/etc/modprobe.d/sriov.conf:
+ file.managed:
+ - contents: |
+ blacklist ixgbevf
+ blacklist igbvf
+ blacklist i40evf
+
+{%- if system.kernel.get('unsafe_interrupts', false) %}
+
+/etc/modprobe.d/iommu_unsafe_interrupts.conf:
+ file.managed:
+ - contents: options vfio_iommu_type1 allow_unsafe_interrupts=1
+
+{%- endif %}
diff --git a/tests/pillar/system.sls b/tests/pillar/system.sls
index 9831d9f..152766d 100644
--- a/tests/pillar/system.sls
+++ b/tests/pillar/system.sls
@@ -19,6 +19,13 @@
term: xterm
prompt:
default: "test01.local$"
+ kernel:
+ hugepages:
+ large:
+ default: true
+ size: 1G
+ count: 210
+ mount_point: /mnt/hugepages_1GB
motd:
- warning: |
#!/bin/sh