Refactored multipath support
diff --git a/README.rst b/README.rst
index a1c93a1..67b17c9 100644
--- a/README.rst
+++ b/README.rst
@@ -612,6 +612,82 @@
size: 40G
mount: ${linux:storage:mount:data}
+
+Multipath with Fujitsu Eternus DXL
+
+.. code-block:: yaml
+
+ parameters:
+ linux:
+ storage:
+ multipath:
+ enabled: true
+ blacklist_devices:
+ - /dev/sda
+ - /dev/sdb
+ backends:
+ - fujitsu_eternus_dxl
+
+Multipath with Hitachi VSP 1000
+
+.. code-block:: yaml
+
+ parameters:
+ linux:
+ storage:
+ multipath:
+ enabled: true
+ blacklist_devices:
+ - /dev/sda
+ - /dev/sdb
+ backends:
+ - hitachi_vsp1000
+
+Multipath with IBM Storwize
+
+.. code-block:: yaml
+
+ parameters:
+ linux:
+ storage:
+ multipath:
+ enabled: true
+ blacklist_devices:
+ - /dev/sda
+ - /dev/sdb
+ backends:
+ - ibm_storwize
+
+Multipath with multiple backends
+
+.. code-block:: yaml
+
+ parameters:
+ linux:
+ storage:
+ multipath:
+ enabled: true
+ blacklist_devices:
+ - /dev/sda
+ - /dev/sdb
+ - /dev/sdc
+ - /dev/sdd
+ backends:
+ - ibm_storwize
+ - fujitsu_eternus_dxl
+ - hitachi_vsp1000
+
+Disabled multipath (the default setup)
+
+.. code-block:: yaml
+
+ parameters:
+ linux:
+ storage:
+ multipath:
+ enabled: false
+
+
Usage
=====
diff --git a/linux/files/multipath.conf b/linux/files/multipath.conf
index 3d8cce7..382d775 100644
--- a/linux/files/multipath.conf
+++ b/linux/files/multipath.conf
@@ -1,98 +1,22 @@
{%- from "linux/map.jinja" import storage with context %}
##
-## This is a template multipath-tools configuration file
-## Uncomment the lines relevent to your environment
+## This is multipath-tools configuration file managed by Salt
##
-{% set backend = storage.get('backend', 'default') %}
-
-{%- if backend in ['hitachi', 'hds', 'HDS'] %}
defaults {
-# udev_dir /dev
-# polling_interval 10
-# selector "round-robin 0"
-# path_grouping_policy multibus
-# getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
-# prio const
-# path_checker directio
-# rr_min_io 100
-# flush_on_last_del no
-# max_fds 8192
-# rr_weight priorities
-# failback immediate
-# no_path_retry fail
-# queue_without_daemon no
- user_friendly_names no
-# mode 644
-# uid 0
-# gid disk
-}
-
-{%- elif backend in ['fujitsu'] %}
-defaults {
- user_friendly_names no
-}
-blacklist {
- wwid "355cd2e404b76b*"
-}
-devices {
- device {
- vendor "FUJITSU"
- product "ETERNUS_DXL"
- prio alua
- path_grouping_policy group_by_prio
- path_selector "round-robin 0"
- failback immediate
- no_path_retry 0
- path_checker tur
- dev_loss_tmo 2097151
- fast_io_fail_tmo 1
- }
-}
-
-{%- else %}
-
-defaults {
- getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
- user_friendly_names no
+# getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
+ user_friendly_names no
}
blacklist {
-# wwid 26353900f02796769
-# devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
-# devnode "^hd[a-z][[0-9]*]"
-# device {
-# vendor DEC.*
-# product MSA[15]00
-# }
- #
- # POZOR - filtrace vseho krome blacklistovanych veci
- #
-# wwid "*"
+ {%- for device in storage.multipath.get('blacklist_devices', []) %}
+ wwid {{ salt['cmd.run']('/lib/udev/scsi_id -g -u '+device) }}
+ {%- endfor %}
+ devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st|nbd)[0-9]*"
}
-blacklist_exceptions {
-# devnode "^dasd[c-d]+[0-9]*"
-# wwid "IBM.75000000092461.4d00.34"
-# wwid 3600507680280050cd000000000000035
-# wwid 3600507680280050cd000000000000030
-# wwid 3600507680280050cd0000000000000ac
-# wwid 3600507680280050cd0000000000003df
- wwid "*"
-}
+
devices {
- device {
- vendor "IBM"
- product "2145"
- path_grouping_policy group_by_prio
- getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
- features "1 queue_if_no_path"
- prio alua
- path_checker tur
- failback immediate
- no_path_retry "5"
- rr_min_io 1
- polling_interval 30
- dev_loss_tmo 120
- }
+ {%- for backend in storage.multipath.get('backends', []) %}
+ {%- include "linux/files/multipath/_" + backend + ".conf" %}
+ {%- endfor %}
}
-{%- endif %}
diff --git a/linux/files/multipath.conf.hds b/linux/files/multipath.conf.hds
deleted file mode 100644
index 0bc246f..0000000
--- a/linux/files/multipath.conf.hds
+++ /dev/null
@@ -1,24 +0,0 @@
-##
-## This is a template multipath-tools configuration file
-## Uncomment the lines relevent to your environment
-##
-defaults {
-# udev_dir /dev
-# polling_interval 10
-# selector "round-robin 0"
-# path_grouping_policy multibus
-# getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
-# prio const
-# path_checker directio
-# rr_min_io 100
-# flush_on_last_del no
-# max_fds 8192
-# rr_weight priorities
-# failback immediate
-# no_path_retry fail
-# queue_without_daemon no
- user_friendly_names no
-# mode 644
-# uid 0
-# gid disk
-}
diff --git a/linux/files/multipath/_fujitsu_eternus_dxl.conf b/linux/files/multipath/_fujitsu_eternus_dxl.conf
new file mode 100644
index 0000000..42b973d
--- /dev/null
+++ b/linux/files/multipath/_fujitsu_eternus_dxl.conf
@@ -0,0 +1,13 @@
+
+ device {
+ vendor "FUJITSU"
+ product "ETERNUS_DXL"
+ prio alua
+ path_grouping_policy group_by_prio
+ path_selector "round-robin 0"
+ failback immediate
+ no_path_retry 0 (*1)
+ path_checker tur
+ dev_loss_tmo 2097151 (*2)
+ fast_io_fail_tmo 1
+ }
diff --git a/linux/files/multipath/_hitachi_vsp1000.conf b/linux/files/multipath/_hitachi_vsp1000.conf
new file mode 100644
index 0000000..754a878
--- /dev/null
+++ b/linux/files/multipath/_hitachi_vsp1000.conf
@@ -0,0 +1,2 @@
+
+# vsp1000 does not have special device config
\ No newline at end of file
diff --git a/linux/files/multipath/_ibm_storwize.conf b/linux/files/multipath/_ibm_storwize.conf
new file mode 100644
index 0000000..a886123
--- /dev/null
+++ b/linux/files/multipath/_ibm_storwize.conf
@@ -0,0 +1,15 @@
+
+ device {
+ vendor "IBM"
+ product "2145"
+ path_grouping_policy group_by_prio
+ getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
+ features "1 queue_if_no_path"
+ prio alua
+ path_checker tur
+ failback immediate
+ no_path_retry "5"
+ rr_min_io 1
+ polling_interval 30
+ dev_loss_tmo 120
+ }
diff --git a/linux/map.jinja b/linux/map.jinja
index 99f8d18..1945a40 100644
--- a/linux/map.jinja
+++ b/linux/map.jinja
@@ -117,20 +117,31 @@
'mount': {},
'swap': {},
'lvm': {},
- 'multipath': False,
+ 'multipath': {
+ 'enabled': False,
+ 'pkgs': ['multipath-tools', 'multipath-tools-boot'],
+ 'service': ''
+ },
},
'Debian': {
'mount': {},
'swap': {},
'lvm': {},
- 'multipath': False,
- 'multipath_pkgs': ['multipath-tools'],
+ 'multipath': {
+ 'enabled': False,
+ 'pkgs': ['multipath-tools', 'multipath-tools-boot'],
+ 'service': 'multipath-tools'
+ },
'lvm_pkgs': ['lvm2'],
},
'RedHat': {
'mount': {},
'swap': {},
'lvm': {},
- 'multipath': False,
+ 'multipath': {
+ 'enabled': False,
+ 'pkgs': [],
+ 'service': 'multipath'
+ },
},
}, grain='os_family', merge=salt['pillar.get']('linux:storage')) %}
diff --git a/linux/storage/init.sls b/linux/storage/init.sls
index 214c452..6661841 100644
--- a/linux/storage/init.sls
+++ b/linux/storage/init.sls
@@ -10,7 +10,7 @@
{%- if storage.lvm|length > 0 %}
- linux.storage.lvm
{%- endif %}
-{%- if storage.multipath %}
+{%- if storage.multipath.enabled %}
- linux.storage.multipath
{%- endif %}
{%- endif %}
diff --git a/linux/storage/multipath.sls b/linux/storage/multipath.sls
index ae9151a..6bcadd1 100644
--- a/linux/storage/multipath.sls
+++ b/linux/storage/multipath.sls
@@ -1,48 +1,24 @@
{%- from "linux/map.jinja" import storage with context %}
-{%- if storage.enabled %}
+{%- if storage.enabled and storage.multipath.enabled %}
-{%- if grains.os_family == 'Debian' %}
-
-linux_multipath_pkgs:
+linux_storage_multipath_packages:
pkg.installed:
- - names: {{ storage.multipath_pkgs }}
+ - names: {{ storage.multipath.pkgs }}
-{%- if storage.multipath.backend not in ['fujitsu'] %}
-
-linux_multipath_boot_pkg:
- pkg.installed:
- - name: multipath-tools-boot
-
-{%- endif %}
-
-{%- if storage.multipath.backend == 'HDS' %}
-
-/etc/multipath.conf:
+linux_storage_multipath_config:
file.managed:
- - source: salt://linux/files/multipath.conf.hds
- - template: jinja
- - require:
- - pkg: linux_multipath_pkgs
-
-{%- else %}
-
-/etc/multipath.conf:
- file.managed:
+ - name: /etc/multipath.conf
- source: salt://linux/files/multipath.conf
- template: jinja
- require:
- - pkg: linux_multipath_pkgs
+ - pkg: linux_storage_multipath_packages
-{%- endif %}
-
-multipath_service:
+linux_storage_multipath_service:
service.running:
- - enable: True
- - name: multipath-tools
+ - enable: true
+ - name: {{ storage.multipath.service }}
- watch:
- - file: /etc/multipath.conf
+ - file: linux_storage_multipath_config
- sig: multipathd
{%- endif %}
-
-{%- endif %}