Skip to content

Commit

Permalink
fix(kernel): fix kernel module states
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Sep 11, 2019
1 parent ab04191 commit 0fca2fa
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 41 deletions.
6 changes: 3 additions & 3 deletions iscsi/initiator/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ iscsi:
vendor: FreeBSD Foundation
svcname: iscsid
kmodule: iscsi_initiator
modloadtext: iscsi_initiator_load="YES"
kmoduletext: iscsi_initiator_load="YES"
svcloadfile: /etc/rc.conf
svcloadtext: iscsictl_enable="YES"
config: /etc/iscsi.conf
Expand All @@ -28,7 +28,7 @@ iscsi:
vendor: Open-iSCSI
svcname: open-iscsi
kmodule: None
modloadtext: xxxxxxxxx="YES"
kmoduletext: xxxxxxxxx="YES"
svcloadfile:
svcloadtext:
config: /etc/iscsi/iscsid.conf
Expand Down Expand Up @@ -72,7 +72,7 @@ iscsi:
vendor:
svcname: ['fcoe', 'lldpad',]
kmodule: None
modloadtext: xxxxxxxxx="YES"
kmoduletext: xxxxxxxxx="YES"
svcloadfile:
svcloadtext:
targetconf: /etc/fcoe/cfg-ethx
Expand Down
15 changes: 7 additions & 8 deletions iscsi/initiator/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,25 @@ iscsi_initiator_service_config:
data: {{ data|json }}
component: 'initiator'
provider: {{ provider }}
json: {{ data['man5']['format']['json']|json }}
json: {{ data.man5.format.json|json }}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kloadtext %}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kmoduletext %}
iscsi_initiator_kernel_module:
file.line:
- name: {{ iscsi.kernel.modloadfile }}
- content: {{ data.man5.kloadtext }}
- content: {{ data.man5.kmoduletext }}
- backup: True
{%- if not iscsi.client.enabled %}
- mode: delete
cmd.run:
- name: {{ iscsi.initiator.kernel.modunload }}
- onlyif: {{ iscsi.initiator.kernel.modquery }}
- name: {{ iscsi.kernel.modunload }} {{ data.man5.kmodule }}
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
{%- else %}
- mode: ensure
- after: autoboot_delay.*$
cmd.run:
- name: {{ iscsi.initiator.kernel.modload }}
- unless: {{ iscsi.initiator.kernel.modquery }}
- name: {{ iscsi.kernel.modload }} {{ data.man5.kmodule }}
- unless: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
- require:
- file: iscsi_initiator_kernel_module
{%- endif %}
Expand Down Expand Up @@ -130,4 +130,3 @@ iscsi_initiator_service:
{%- if data.man5.kmodule %}
- unless: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
{%- endif %}
13 changes: 6 additions & 7 deletions iscsi/initiator/remove.sls
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@ iscsi_initiator_service_dead:
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
{%- endif %}
{%- set kmodule = iscsi.client['provider']['man5']['kmodule'] %}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kloadtext %}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kmoduletext %}
iscsi_initiator_kernel_module_{{ data.man5.kmodule }}_removed:
file.line:
- name: {{ iscsi.kernel.modloadfile }}
- content: {{ data.man5.kloadtext }}
- content: {{ data.man5.kmoduletext }}
- backup: True
- mode: delete
cmd.run:
- name: {{ iscsi.initiator.kernel.modunload }}
- onlyif: {{ iscsi.initiator.kernel.modquery }}
- name: {{ iscsi.kernel.modunload }} {{ data.man5.kmodule }}
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
- require:
- iscsi_initiator_service_dead
- require_in:
Expand All @@ -44,5 +43,5 @@ iscsi_initiator_wanted_pkgs_{{ pkg }}_removed:
iscsi_initiator_service_config_removed:
file.absent:
- name: {{ iscsi.initiator.man5.config }}
- onlyif: test -f {{ iscsi.initiator.man5.config }}
- name: {{ data.man5.config }}
- onlyif: test -f {{ data.man5.config }}
1 change: 0 additions & 1 deletion iscsi/isns/remove.sls
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ iscsi_isns_remove_{{ pkg }}_pkg:
- require:
- service: iscsi_isns_service_config_removed
{% endfor %}
10 changes: 5 additions & 5 deletions iscsi/target/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ iscsi:
vendor: tgt project
svcname: tgtd
kmodule: None
modloadtext: xxxxxxxxx="YES"
kmoduletext: xxxxxxxxx="YES"
svcloadfile:
svcloadtext:
config: /etc/tgt/conf.d/targets.conf
Expand All @@ -36,7 +36,7 @@ iscsi:
vendor: FreeBSD Foundation
svcname: ctld #CAM Target Layer/iSCSI target daemon
kmodule: cfiscsi
modloadtext: cfiscsi_load="YES"
kmoduletext: cfiscsi_load="YES"
svcloadfile: /etc/rc.conf
svcloadtext: 'iscsid_enable="YES"'
allowconf:
Expand Down Expand Up @@ -68,7 +68,7 @@ iscsi:
vendor: IET project
svcname: iscsitarget
kmodule: iscsi_trgt
modloadtext: iscsi_trgt
kmoduletext: iscsi_trgt
svcloadfile:
svcloadtext:
config: /etc/ietd.conf
Expand Down Expand Up @@ -108,7 +108,7 @@ iscsi:
vendor: Kernel.org
svcname: target
kmodule: target_core_mod
modloadtext: target_core_mod
kmoduletext: target_core_mod
svcloadfile:
svcloadtext:
config: /etc/target/saveconfig.json
Expand All @@ -133,7 +133,7 @@ iscsi:
vendor:
svcname: fcoe-target
kmodule: fcoe_target
modloadtext: fcoe_target
kmoduletext: fcoe_target
svcloadfile:
svcloadtext:
config: ....
Expand Down
15 changes: 7 additions & 8 deletions iscsi/target/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,25 @@ iscsi_target_service_config:
data: {{ data|json }}
component: 'target'
provider: {{ provider }}
json: {{ data['man5']['format']['json']|json }}
json: {{ data.man5.format.json|json }}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kloadtext %}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kmoduletext %}
iscsi_target_kernel_module:
file.line:
- name: {{ iscsi.kernel.modloadfile }}
- content: {{ data.man5.kloadtext }}
- content: {{ data.man5.kmoduletext }}
- backup: True
{%- if not data.enabled %}
- mode: delete
cmd.run:
- name: {{ data.kernel.modunload }}
- onlyif: {{ data.kernel.modquery }}
- name: {{ iscsi.kernel.modunload }} {{ data.man5.kmodule }}
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
{%- else %}
- mode: ensure
- after: 'autoboot_delay.*'
cmd.run:
- name: {{ data.kernel.modload }}
- unless: {{ data.kernel.modquery }}
- name: {{ iscsi.kernel.modload }} {{ data.man5.kmodule }}
- unless: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
- require:
- file: iscsi_target_kernel_module
{%- endif %}
Expand Down Expand Up @@ -132,4 +132,3 @@ iscsi_target_service_running:
{%- if data.man5.kmodule %}
- unless: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
{%- endif %}
15 changes: 6 additions & 9 deletions iscsi/target/remove.sls
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,16 @@ iscsi_target_service_dead:
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
{%- endif %}
{%- set kmodule = iscsi.server['provider']['man5']['kmodule'] %}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kloadtext %}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kmoduletext %}
iscsi_target_kernel_module_{{ data.man5.kmodule }}_removed:
file.line:
- name: {{ iscsi.kernel.modloadfile }}
- content: {{ data.man5.kloadtext }}
- content: {{ data.man5.kmoduletext }}
- backup: True
- mode: delete
cmd.run:
- name: {{ iscsi.target.kernel.modunload }}
- onlyif: {{ iscsi.target.kernel.modquery }}
- name: {{ iscsi.kernel.modunload }} {{ data.man5.kmodule }}
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
- require:
- iscsi_target_service_dead
- require_in:
Expand All @@ -45,6 +43,5 @@ iscsi_target_wanted_pkgs_{{ pkg }}_removed:
iscsi_target_service_config_removed:
file.absent:
- name: {{ iscsi.target.man5.config }}
- onlyif: test -f {{ iscsi.target.man5.config }}
- name: {{ data.man5.config }}
- onlyif: test -f {{ data.man5.config }}

0 comments on commit 0fca2fa

Please sign in to comment.