From patchwork Tue Dec 10 19:29:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13901962 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F2B223ED63 for ; Tue, 10 Dec 2024 19:29:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733858966; cv=none; b=BwFIbKU3xpO/NIZxLx+RH9l+qymuWpeRB78WabOOjLKfdKVmI+7/3Oxm4GCJ42UaIl3zP5ImPDBBY/k7Es1+Kqfqz39Dhl/plOp/19o8YHlPvvY3rfmrdqzoPagY/hPlOG3FH8EgCuC2FspH1v3fMlIiJj/G/g98kbbhNhEFD1Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733858966; c=relaxed/simple; bh=Jai//vDad0Ky+zdr7Z10XVw+VD7mO9D4dBozSCDJNdA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e+ioFOF2CWjJtVvn0yoJi1G4UI1kifRZ/iqULRv6Ydv3el3iTMu/+jorN75PF/ykae0YUsqUicJkK5fngiwN/BRK/WEa4l4qnDT0QymMSjvM286J6tnYfimrSTPL26dpRc/p91iV9aLDxfjb5Cmq4czMAwgT78bKB+n/+85HVgk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Vh+yr+tE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Vh+yr+tE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C65CC4CEE3; Tue, 10 Dec 2024 19:29:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733858965; bh=Jai//vDad0Ky+zdr7Z10XVw+VD7mO9D4dBozSCDJNdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vh+yr+tEkHyGuln+CaEeeCZ3x3XAhzPlHQ2IV7Oxz94C/fIDb0b9t6d7pJebivAz8 DcR1ZmE2dPoM9sjTle8GV0dCbBEwFeksp3F82VS1xWSdves//3BnIFX7C0UqyaUZPS BenDzlu+sd+gwPGrhL0RmvOzmaP4t4CL3XOGAagWv1y04ksz+BUd/fJ31+N51kcktd cgZdoC00KFqUvi4kU8+pQQunfNNzx7NV2MOz0/o9T5dZTYe74VISOBCF1sDi2t+jd1 zYett0D/Ac4BW3Yx9kE0/5UCnl/Uk3d0BBEgr8etr07wuv9IRDi4tB0L4YTaAcQw5j LYdyQXHg1WFMA== From: cel@kernel.org To: Cc: Anna Schumaker , Chuck Lever Subject: [PATCH 4/6] NFSD: Implement NVMe storage for NFSD exports Date: Tue, 10 Dec 2024 14:29:17 -0500 Message-ID: <20241210192920.682914-5-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241210192920.682914-1-cel@kernel.org> References: <20241210192920.682914-1-cel@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever Signed-off-by: Chuck Lever --- 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