kdevops.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Chuck Lever <cel@kernel.org>
To: kdevops@lists.linux.dev
Subject: [PATCH RFC] nfsd: Enable kdevops-nfsd to export tmpfs file systems
Date: Thu, 14 Dec 2023 09:44:26 -0500	[thread overview]
Message-ID: <170256506606.531109.3478901854565826004.stgit@renoir.1015granger.net> (raw)

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

tmpfs can be exported via NFS in deployments where fast shared
storage is needed, but the data does not need to be resilient to
server crashes (eg, batch job scratch files). So add the ability to
target tmpfs exports for kdevops workflows.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 kconfigs/Kconfig.nfsd                          |    4 ++++
 playbooks/roles/nfsd_add_export/tasks/main.yml |   21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/kconfigs/Kconfig.nfsd b/kconfigs/Kconfig.nfsd
index 0dd28e90ee45..3352c27183d9 100644
--- a/kconfigs/Kconfig.nfsd
+++ b/kconfigs/Kconfig.nfsd
@@ -31,6 +31,9 @@ config NFSD_EXPORT_FSTYPE_XFS
 config NFSD_EXPORT_FSTYPE_EXT4
 	bool "ext4"
 
+config NFSD_EXPORT_FSTYPE_TMPFS
+	bool "tmpfs"
+
 endchoice
 
 config NFSD_EXPORT_FSTYPE
@@ -38,6 +41,7 @@ config NFSD_EXPORT_FSTYPE
 	default "btrfs" if NFSD_EXPORT_FSTYPE_BTRFS
 	default "xfs" if NFSD_EXPORT_FSTYPE_XFS
 	default "ext4" if NFSD_EXPORT_FSTYPE_EXT4
+	default "tmpfs" if NFSD_EXPORT_FSTYPE_TMPFS
 
 config NFSD_EXPORT_PATH
 	string "The path under which to mount the devices to be exported."
diff --git a/playbooks/roles/nfsd_add_export/tasks/main.yml b/playbooks/roles/nfsd_add_export/tasks/main.yml
index 1d297c38c243..ad3efdba5e2c 100644
--- a/playbooks/roles/nfsd_add_export/tasks/main.yml
+++ b/playbooks/roles/nfsd_add_export/tasks/main.yml
@@ -1,3 +1,4 @@
+---
 - name: Create a new LVM partition
   become: yes
   become_flags: 'su - -c'
@@ -7,6 +8,8 @@
     vg: exports
     lv: "{{ export_volname }}"
     size: "{{ export_size }}"
+  when:
+    - export_fstype != "tmpfs"
 
 - name: Format new volume for {{ export_fstype }}
   become: yes
@@ -16,6 +19,8 @@
   filesystem:
     fstype: "{{ export_fstype }}"
     dev: "/dev/exports/{{ export_volname }}"
+  when:
+    - export_fstype != "tmpfs"
 
 - name: Mount volume under {{ nfsd_export_path }}
   become: yes
@@ -28,6 +33,22 @@
     src: "/dev/exports/{{ export_volname }}"
     fstype: "{{ export_fstype }}"
     state: mounted
+  when:
+    - export_fstype != "tmpfs"
+
+- name: Mount tmpfs under {{ nfsd_export_path }}
+  become: yes
+  become_flags: 'su - -c'
+  become_method: sudo
+  delegate_to: "{{ server_host }}"
+  throttle: 1  # running this in parallel can clobber fstab changes
+  mount:
+    path: "{{ nfsd_export_path }}/{{ export_volname }}"
+    src: "tmpfs"
+    fstype: "tmpfs"
+    state: mounted
+  when:
+    - export_fstype == "tmpfs"
 
 - name: Test whether SELinux is enabled
   command: /usr/sbin/selinuxenabled



                 reply	other threads:[~2023-12-14 14:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=170256506606.531109.3478901854565826004.stgit@renoir.1015granger.net \
    --to=cel@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).