All of lore.kernel.org
 help / color / mirror / Atom feed
From: cel@kernel.org
To: <kdevops@lists.linux.dev>
Cc: Anna Schumaker <anna@kernel.org>, Chuck Lever <chuck.lever@oracle.com>
Subject: [PATCH 4/6] NFSD: Implement NVMe storage for NFSD exports
Date: Tue, 10 Dec 2024 14:29:17 -0500	[thread overview]
Message-ID: <20241210192920.682914-5-cel@kernel.org> (raw)
In-Reply-To: <20241210192920.682914-1-cel@kernel.org>

From: Chuck Lever <chuck.lever@oracle.com>

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 kconfigs/Kconfig.nfsd                  | 12 +++++++---
 playbooks/roles/nfsd/defaults/main.yml |  1 +
 playbooks/roles/nfsd/tasks/main.yml    | 31 +++++++++++++++++++++-----
 scripts/nfsd.Makefile                  |  4 ++++
 4 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/kconfigs/Kconfig.nfsd b/kconfigs/Kconfig.nfsd
index d071f5fba278..0cc671b396df 100644
--- a/kconfigs/Kconfig.nfsd
+++ b/kconfigs/Kconfig.nfsd
@@ -67,14 +67,14 @@ config NFSD_LEASE_TIME
 	  complete faster.
 
 choice
-	prompt "Local or external physical storage"
+	prompt "Persistent storage for exported file systems"
 	default NFSD_EXPORT_STORAGE_LOCAL
 
 config NFSD_EXPORT_STORAGE_LOCAL
 	bool "Local"
 	help
 	  Exported file systems will reside on physical storage
-	  local to the NFS server itself.
+	  devices local to the NFS server itself.
 
 config NFSD_EXPORT_STORAGE_ISCSI
 	bool "iSCSI"
@@ -83,12 +83,18 @@ config NFSD_EXPORT_STORAGE_ISCSI
 	  located on a separate target node and accessed via
 	  iSCSI.
 
+config NFSD_EXPORT_STORAGE_NVME
+	bool "NVMe"
+	help
+	  Exported file systems will reside in NVMe namespaces
+	  local to the NFS server itself.
+
 endchoice
 
 if NFSD_EXPORT_STORAGE_LOCAL
 
 config NFSD_EXPORT_DEVICE_PREFIX
-	string "The device prefix to use for LVM PVs"
+	string "The block device name prefix to use for LVM PVs"
 	default "/dev/disk/by-id/nvme-QEMU_NVMe_Ctrl_kdevops" if LIBVIRT && LIBVIRT_EXTRA_STORAGE_DRIVE_NVME
 	default "/dev/disk/by-id/virtio-kdevops" if LIBVIRT && LIBVIRT_EXTRA_STORAGE_DRIVE_VIRTIO
 	default "/dev/disk/by-id/ata-QEMU_HARDDISK_kdevops" if LIBVIRT && LIBVIRT_EXTRA_STORAGE_DRIVE_IDE
diff --git a/playbooks/roles/nfsd/defaults/main.yml b/playbooks/roles/nfsd/defaults/main.yml
index 271d2d1d8912..59e8d74f372b 100644
--- a/playbooks/roles/nfsd/defaults/main.yml
+++ b/playbooks/roles/nfsd/defaults/main.yml
@@ -10,5 +10,6 @@ nfsd_lease_time: "90"
 
 nfsd_export_storage_local: false
 nfsd_export_storage_iscsi: false
+nfsd_export_storage_nvme: false
 
 kdevops_krb5_enable: false
diff --git a/playbooks/roles/nfsd/tasks/main.yml b/playbooks/roles/nfsd/tasks/main.yml
index 63388f857627..c7c41e79714b 100644
--- a/playbooks/roles/nfsd/tasks/main.yml
+++ b/playbooks/roles/nfsd/tasks/main.yml
@@ -29,7 +29,7 @@
   when:
     - nfsd_export_storage_iscsi|bool
 
-- name: Build string of devices to use as PVs
+- name: Build a list of block devices to provision as PVs
   set_fact:
     nfsd_lvm_pvs: "{{ nfsd_lvm_pvs + [ nfsd_export_device_prefix + item|string ] }}"
   with_items: "{{ range(1, nfsd_export_device_count + 1) }}"
@@ -38,15 +38,34 @@
   when:
     - nfsd_export_storage_local|bool
 
-- name: Create a new LVM VG
-  become: yes
-  become_flags: 'su - -c'
-  become_method: sudo
+- name: Enumerate NVMe devices to provision as PVs
+  become: true
+  become_flags: "su - -c"
+  become_method: ansible.builtin.sudo
+  ansible.builtin.command:
+    cmd: "lsblk -np -o PATH,SERIAL"
+  register: lsblk_output
+  changed_when: false
+  when:
+    - nfsd_export_storage_nvme|bool
+
+- name: Build a list of NVMe devices to provision as PVs
+  ansible.builtin.set_fact:
+    nfsd_lvm_pvs: "{{ nfsd_lvm_pvs + [item | split() | first] }}"
+  loop: "{{ lsblk_output.stdout_lines }}"
+  when:
+    - nfsd_export_storage_nvme|bool
+    - '"AWS" in item'
+
+- name: Create a new LVM Volume Group
+  become: true
+  become_flags: "su - -c"
+  become_method: ansible.builtin.sudo
   community.general.lvg:
     vg: "exports"
     pvs: "{{ nfsd_lvm_pvs | join(',') }}"
   when:
-    - nfsd_export_storage_local|bool
+    - nfsd_export_storage_local|bool or nfsd_export_storage_nvme|bool
 
 - name: Create {{ nfsd_export_path }}
   become: yes
diff --git a/scripts/nfsd.Makefile b/scripts/nfsd.Makefile
index 959cc4b7652d..b36fa25d915a 100644
--- a/scripts/nfsd.Makefile
+++ b/scripts/nfsd.Makefile
@@ -10,6 +10,10 @@ ifeq (y,$(CONFIG_NFSD_EXPORT_STORAGE_ISCSI))
 NFSD_EXTRA_ARGS += nfsd_export_storage_iscsi=true
 endif
 
+ifeq (y,$(CONFIG_NFSD_EXPORT_STORAGE_NVME))
+NFSD_EXTRA_ARGS += nfsd_export_storage_nvme=true
+endif
+
 ifeq (y,$(CONFIG_FSTESTS_NFS_SECTION_NFSD))
 NFSD_EXTRA_ARGS += kdevops_loopback_nfs_enable=true
 endif
-- 
2.47.0


  parent reply	other threads:[~2024-12-10 19:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10 19:29 [PATCH 0/6] Recent fixes cel
2024-12-10 19:29 ` [PATCH 1/6] fstests: Fix NFS mount options for fstests cel
2024-12-10 19:29 ` [PATCH 2/6] gen_nodes: Fix generation of the list of test nodes cel
2024-12-10 19:29 ` [PATCH 3/6] fstests: Fix selection of NFSD export type for the pNFS test section cel
2024-12-10 19:29 ` cel [this message]
2024-12-11  3:42   ` [PATCH 4/6] NFSD: Implement NVMe storage for NFSD exports Luis Chamberlain
2024-12-11 13:50     ` Chuck Lever
2024-12-12  2:28       ` Luis Chamberlain
2024-12-10 19:29 ` [PATCH 5/6] playbooks: Add a Code Ready Builder role cel
2024-12-10 19:29 ` [PATCH 6/6] codereadyrepo: Enable codeready-builder in AWS cel
2024-12-11  3:44 ` [PATCH 0/6] Recent fixes Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241210192920.682914-5-cel@kernel.org \
    --to=cel@kernel.org \
    --cc=anna@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=kdevops@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.