fstests/nfs: add ability to test with NFS loopback mounts
PATCH v3 1/1 fstests/nfs: add ability to test with NFS loopback mounts
Add the ability to test with NFS loopback mounts (meaning NFS mounts where the NFS server is also a client - not necessarily using the loopback interface). The primary motivation is to facilitate testing of NFS with LOCALIO support:
https://lore.kernel.org/linux-nfs/[email protected]/T/#t
The changes should be pretty straightforward for the most part, the one exception being the change to the "Check which fstests test types are enabled" task in both the gen_hosts and gen_nodes playbooks. Here we add some logic to cause the "[nfsd]" section of nfs.config to be ignored. The reason for that is so that we don't wind up with a value of "nfs-nfsd" to be added fstests_enabled_test_types list, which would then cause a bogus "{{ kdevops-hosts-prefix }}-nfs-nfsd guestfs node configuration to be created as well as a bogus entry to be added to the ansible inventory file.
---
Changes in v3:
- The previous version actually broke testing in the non-loopback case because it was relying on the "fstests_nfs_section_nfsd" variable, which isn't defined during the bringup phase. Added a new variable "kdevops_loopback_nfs_enable" which fixes this and also makes the intention in the fstests.j2 template clearer.
Changes in v2:
- make use of the new yaml output feature for the new kconfig option
- add note in the help text stating that it's hardcoded to use v4.1
playbooks/roles/fstests/defaults/main.yml | 1 + playbooks/roles/fstests/templates/nfs/nfs.config | 7 +++++++ playbooks/roles/gen_hosts/defaults/main.yml | 1 + playbooks/roles/gen_hosts/tasks/main.yml | 3 ++- playbooks/roles/gen_hosts/templates/fstests.j2 | 15 +++++++++++++++ playbooks/roles/gen_nodes/tasks/main.yml | 3 ++- scripts/nfsd.Makefile | 4 ++++ workflows/fstests/nfs/Kconfig | 10 ++++++++++ 8 files changed, 42 insertions(+), 2 deletions(-)
playbooks/roles/fstests/defaults/main.yml +1 -0
@@ -166,6 +166,7 @@ fstests_nfs_use_kdevops_nfsd: False fstests_nfs_section_pnfs: False fstests_nfs_section_rdma: False fstests_nfs_section_tls: False +fstests_nfs_section_nfsd: False fstests_nfs_section_default: False fstests_nfs_section_v42: False fstests_nfs_section_v41: False
playbooks/roles/fstests/templates/nfs/nfs.config +7 -0
@@ -31,6 +31,13 @@ MOUNT_OPTIONS="-o rdma" TEST_FS_MOUNT_OPTS="-o xprtsec=mtls" MOUNT_OPTIONS="-o xprtsec=mtls" {% endif %} +{% if fstests_nfs_section_nfsd -%} + +# Test NFS over loopback +[nfsd] +TEST_FS_MOUNT_OPTS="-o vers=4.1" +MOUNT_OPTIONS="-o vers=4.1" +{% endif %} {% if fstests_nfs_section_v42 -%} # Test NFSv4.2
playbooks/roles/gen_hosts/defaults/main.yml +1 -0
@@ -34,6 +34,7 @@ fs_config_role_path: "/dev/null" fs_config_data: "[section_1]" kdevops_nfsd_enable: False +kdevops_loopback_nfs_enable: False kdevops_smbd_enable: False kdevops_krb5_enable: False kdevops_enable_iscsi: false
playbooks/roles/gen_hosts/tasks/main.yml +2 -1
@@ -154,7 +154,8 @@ config_val: "{{ 'CONFIG_FSTESTS_' + fs + '_SECTION_' }}" fs_config_data: "{{ lookup('file', fs_config_path) }}" sections_without_default: "{{ fs_config_data | regex_replace('\\[default\\]', multiline=True) }}" - sections_lines: "{{ sections_without_default | regex_findall('^\\[(.*)', multiline=True) }}" + sections_without_default_and_nfsd: "{{ sections_without_default | regex_replace('\\[nfsd\\]', multiline=True) }}" + sections_lines: "{{ sections_without_default_and_nfsd | regex_findall('^\\[(.*)', multiline=True) }}" clean_section_lines: "{{ sections_lines | regex_replace('\\[') | regex_replace('\\]') }}" clean_section_lines_without_fsname: "{{ clean_section_lines | regex_replace(fstests_fstyp + '_') }}" config_sections_targets: "{{ clean_section_lines_without_fsname | replace(\"'\", '') | split(', ') }}"
playbooks/roles/gen_hosts/templates/fstests.j2 +15 -0
@@ -5,12 +5,22 @@ {{ kdevops_host_prefix }}-{{ s }}-dev {% endif %} {% endfor %} +{% if kdevops_nfsd_enable %} +{% if kdevops_loopback_nfs_enable %} +{{ kdevops_hosts_prefix }}-nfsd +{% endif %} +{% endif %} [all:vars] ansible_python_interpreter = "{{ kdevops_python_interpreter }}" [baseline] {% for s in fstests_enabled_test_types %} {{ kdevops_host_prefix }}-{{ s }} {% endfor %} +{% if kdevops_nfsd_enable %} +{% if kdevops_loopback_nfs_enable %} +{{ kdevops_hosts_prefix }}-nfsd +{% endif %} +{% endif %} [baseline:vars] ansible_python_interpreter = "{{ kdevops_python_interpreter }}" [dev]
@@ -18,6 +28,11 @@ ansible_python_interpreter = "{{ kdevops_python_interpreter }}" {% for s in fstests_enabled_test_types %} {{ kdevops_host_prefix }}-{{ s }}-dev {% endfor %} +{% if kdevops_nfsd_enable %} +{% if kdevops_loopback_nfs_enable %} +{{ kdevops_hosts_prefix }}-nfsd +{% endif %} +{% endif %} {% endif %} [dev:vars] ansible_python_interpreter = "{{ kdevops_python_interpreter }}"
playbooks/roles/gen_nodes/tasks/main.yml +2 -1
@@ -213,7 +213,8 @@ config_val: "{{ 'CONFIG_FSTESTS_' + fs + '_SECTION_' }}" fs_config_data: "{{ lookup('file', fs_config_path) }}" sections_without_default: "{{ fs_config_data | regex_replace('\\[default\\]', multiline=True) }}" - sections_lines: "{{ sections_without_default | regex_findall('^\\[(.*)', multiline=True) }}" + sections_without_default_and_nfsd: "{{ sections_without_default | regex_replace('\\[nfsd\\]', multiline=True) }}" + sections_lines: "{{ sections_without_default_and_nfsd | regex_findall('^\\[(.*)', multiline=True) }}" clean_section_lines: "{{ sections_lines | regex_replace('\\[') | regex_replace('\\]') }}" clean_section_lines_without_fsname: "{{ clean_section_lines | regex_replace(fstests_fstyp + '_') }}" config_sections_targets: "{{ clean_section_lines_without_fsname | replace(\"'\", '') | split(', ') }}"
scripts/nfsd.Makefile +4 -0
@@ -10,6 +10,10 @@ ifeq (y,$(CONFIG_NFSD_EXPORT_STORAGE_ISCSI)) NFSD_EXTRA_ARGS += nfsd_export_storage_iscsi=true endif +ifeq (y,$(CONFIG_FSTESTS_NFS_SECTION_NFSD)) +NFSD_EXTRA_ARGS += kdevops_loopback_nfs_enable=true +endif + NFSD_EXTRA_ARGS += nfsd_export_fstype='$(subst ",,$(CONFIG_NFSD_EXPORT_FSTYPE))' NFSD_EXTRA_ARGS += nfsd_export_path='$(subst ",,$(CONFIG_NFSD_EXPORT_PATH))' NFSD_EXTRA_ARGS += nfsd_threads=$(CONFIG_NFSD_THREADS)
workflows/fstests/nfs/Kconfig +10 -0
@@ -68,6 +68,16 @@ config FSTESTS_NFS_SECTION_TLS help Enabling this will test with the xprtsec=tls mount option. +config FSTESTS_NFS_SECTION_NFSD + bool "Enable testing section: nfsd" + output yaml + default n + depends on FSTESTS_USE_KDEVOPS_NFSD + help + Enabling this will test with an NFS client running on the + NFS server itself. Note that this feature is currently + hard-coded to use NFSv4.1. + config FSTESTS_NFS_SECTION_V42 bool "Enable testing section: nfs_v42" default y
Signature · 1 line
2.43.0
Quoted 188 lines · Scott Mayhew
Add the ability to test with NFS loopback mounts (meaning NFS mounts where the NFS server is also a client - not necessarily using the loopback interface). The primary motivation is to facilitate testing of NFS with LOCALIO support:
https://lore.kernel.org/linux-nfs/[email protected]/T/#t
The changes should be pretty straightforward for the most part, the one exception being the change to the "Check which fstests test types are enabled" task in both the
gen_hostsandgen_nodesplaybooks. Here we add some logic to cause the "[nfsd]" section of nfs.config to be ignored. The reason for that is so that we don't wind up with a value of "nfs-nfsd" to be addedfstests_enabled_test_typeslist, which would then cause a bogus "{{ kdevops-hosts-prefix }}-nfs-nfsd guestfs node configuration to be created as well as a bogus entry to be added to the ansible inventory file.Signed-off-by Scott Mayhew <[email protected]>---
Changes in v3:
- The previous version actually broke testing in the non-loopback case because it was relying on the "fstests_nfs_section_nfsd" variable, which isn't defined during the bringup phase. Added a new variable "kdevops_loopback_nfs_enable" which fixes this and also makes the intention in the fstests.j2 template clearer.
Changes in v2:
- make use of the new yaml output feature for the new kconfig option
- add note in the help text stating that it's hardcoded to use v4.1playbooks/roles/fstests/defaults/main.yml | 1 + playbooks/roles/fstests/templates/nfs/nfs.config | 7 +++++++ playbooks/roles/gen_hosts/defaults/main.yml | 1 + playbooks/roles/gen_hosts/tasks/main.yml | 3 ++- playbooks/roles/gen_hosts/templates/fstests.j2 | 15 +++++++++++++++ playbooks/roles/gen_nodes/tasks/main.yml | 3 ++- scripts/nfsd.Makefile | 4 ++++ workflows/fstests/nfs/Kconfig | 10 ++++++++++ 8 files changed, 42 insertions(+), 2 deletions(-)playbooks/roles/fstests/defaults/main.yml +1
-0@@ -166,6 +166,7 @@ fstests_nfs_use_kdevops_nfsd: False fstests_nfs_section_pnfs: False fstests_nfs_section_rdma: False fstests_nfs_section_tls: False +fstests_nfs_section_nfsd: False fstests_nfs_section_default: False fstests_nfs_section_v42: False fstests_nfs_section_v41: Falseplaybooks/roles/fstests/templates/nfs/nfs.config +7
-0@@ -31,6 +31,13 @@ MOUNT_OPTIONS="-o rdma" TEST_FS_MOUNT_OPTS="-o xprtsec=mtls" MOUNT_OPTIONS="-o xprtsec=mtls" {% endif %} +{% if fstests_nfs_section_nfsd -%} + +# Test NFS over loopback +[nfsd] +TEST_FS_MOUNT_OPTS="-o vers=4.1" +MOUNT_OPTIONS="-o vers=4.1" +{% endif %} {% if fstests_nfs_section_v42 -%} # Test NFSv4.2playbooks/roles/gen_hosts/defaults/main.yml +1
-0@@ -34,6 +34,7 @@ fs_config_role_path: "/dev/null" fs_config_data: "[section_1]" kdevops_nfsd_enable: False +kdevops_loopback_nfs_enable: False kdevops_smbd_enable: False kdevops_krb5_enable: False kdevops_enable_iscsi: falseplaybooks/roles/gen_hosts/tasks/main.yml +2
-1@@ -154,7 +154,8 @@ config_val: "{{ 'CONFIG_FSTESTS_' + fs + '_SECTION_' }}" fs_config_data: "{{ lookup('file', fs_config_path) }}" sections_without_default: "{{ fs_config_data | regex_replace('\\[default\\]', multiline=True) }}" - sections_lines: "{{ sections_without_default | regex_findall('^\\[(.*)', multiline=True) }}" + sections_without_default_and_nfsd: "{{ sections_without_default | regex_replace('\\[nfsd\\]', multiline=True) }}" + sections_lines: "{{ sections_without_default_and_nfsd | regex_findall('^\\[(.*)', multiline=True) }}" clean_section_lines: "{{ sections_lines | regex_replace('\\[') | regex_replace('\\]') }}" clean_section_lines_without_fsname: "{{ clean_section_lines | regex_replace(fstests_fstyp + '_') }}" config_sections_targets: "{{ clean_section_lines_without_fsname | replace(\"'\", '') | split(', ') }}"playbooks/roles/gen_hosts/templates/fstests.j2 +15
-0@@ -5,12 +5,22 @@ {{ kdevops_host_prefix }}-{{ s }}-dev {% endif %} {% endfor %} +{% if kdevops_nfsd_enable %} +{% if kdevops_loopback_nfs_enable %} +{{ kdevops_hosts_prefix }}-nfsd +{% endif %} +{% endif %} [all:vars] ansible_python_interpreter = "{{ kdevops_python_interpreter }}" [baseline] {% for s in fstests_enabled_test_types %} {{ kdevops_host_prefix }}-{{ s }} {% endfor %} +{% if kdevops_nfsd_enable %} +{% if kdevops_loopback_nfs_enable %} +{{ kdevops_hosts_prefix }}-nfsd +{% endif %} +{% endif %} [baseline:vars] ansible_python_interpreter = "{{ kdevops_python_interpreter }}" [dev]@@ -18,6 +28,11 @@ ansible_python_interpreter = "{{ kdevops_python_interpreter }}" {% for s in fstests_enabled_test_types %} {{ kdevops_host_prefix }}-{{ s }}-dev {% endfor %} +{% if kdevops_nfsd_enable %} +{% if kdevops_loopback_nfs_enable %} +{{ kdevops_hosts_prefix }}-nfsd +{% endif %} +{% endif %} {% endif %} [dev:vars] ansible_python_interpreter = "{{ kdevops_python_interpreter }}"playbooks/roles/gen_nodes/tasks/main.yml +2
-1@@ -213,7 +213,8 @@ config_val: "{{ 'CONFIG_FSTESTS_' + fs + '_SECTION_' }}" fs_config_data: "{{ lookup('file', fs_config_path) }}" sections_without_default: "{{ fs_config_data | regex_replace('\\[default\\]', multiline=True) }}" - sections_lines: "{{ sections_without_default | regex_findall('^\\[(.*)', multiline=True) }}" + sections_without_default_and_nfsd: "{{ sections_without_default | regex_replace('\\[nfsd\\]', multiline=True) }}" + sections_lines: "{{ sections_without_default_and_nfsd | regex_findall('^\\[(.*)', multiline=True) }}" clean_section_lines: "{{ sections_lines | regex_replace('\\[') | regex_replace('\\]') }}" clean_section_lines_without_fsname: "{{ clean_section_lines | regex_replace(fstests_fstyp + '_') }}" config_sections_targets: "{{ clean_section_lines_without_fsname | replace(\"'\", '') | split(', ') }}"scripts/nfsd.Makefile +4
-0@@ -10,6 +10,10 @@ ifeq (y,$(CONFIG_NFSD_EXPORT_STORAGE_ISCSI)) NFSD_EXTRA_ARGS += nfsd_export_storage_iscsi=true endif +ifeq (y,$(CONFIG_FSTESTS_NFS_SECTION_NFSD)) +NFSD_EXTRA_ARGS += kdevops_loopback_nfs_enable=true +endif + NFSD_EXTRA_ARGS += nfsd_export_fstype='$(subst ",,$(CONFIG_NFSD_EXPORT_FSTYPE))' NFSD_EXTRA_ARGS += nfsd_export_path='$(subst ",,$(CONFIG_NFSD_EXPORT_PATH))' NFSD_EXTRA_ARGS += nfsd_threads=$(CONFIG_NFSD_THREADS)workflows/fstests/nfs/Kconfig +10
-0@@ -68,6 +68,16 @@ config FSTESTS_NFS_SECTION_TLS help Enabling this will test with the xprtsec=tls mount option. +config FSTESTS_NFS_SECTION_NFSD + bool "Enable testing section: nfsd" + output yaml + default n + depends on FSTESTS_USE_KDEVOPS_NFSD + help + Enabling this will test with an NFS client running on the + NFS server itself. Note that this feature is currently + hard-coded to use NFSv4.1. + config FSTESTS_NFS_SECTION_V42 bool "Enable testing section: nfs_v42" default ySignature · 1 line
2.43.0
Signature · 1 line
Chuck Lever