diff mbox series

[2/2] nfsuuid: add some example udev rules

Message ID c99674bbff8508580b232c09d7a593ba1dea6959.1644510803.git.bcodding@redhat.com (mailing list archive)
State New, archived
Headers show
Series [1/2] nfsuuid: a tool to create and persist nfs4 client uniquifiers | expand

Commit Message

Benjamin Coddington Feb. 10, 2022, 4:36 p.m. UTC
Provide several variations on the use of the nfsuuid tool in a udev rule in
order to automagically uniquify NFSv4 clients.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 tools/nfsuuid/example_udev.rules | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 tools/nfsuuid/example_udev.rules
diff mbox series

Patch

diff --git a/tools/nfsuuid/example_udev.rules b/tools/nfsuuid/example_udev.rules
new file mode 100644
index 000000000000..31117387ac59
--- /dev/null
+++ b/tools/nfsuuid/example_udev.rules
@@ -0,0 +1,28 @@ 
+# This is a sample udev rules file that demonstrates how to get udev
+# to set a unique but persistent client id uniquifier for the kernel
+# NFS client.  The NFS client exposes a sysfs entry that can be used to
+# "uniquify" a client.  Values written to this entry are used to create
+# the client's identifier to distinguish a client from all other clients
+# that may claim state from a particular server.  Clients typically use
+# several sources of information to generate a client ID such as hostname,
+# and NFS version numbers, however these values may collide in certain
+# sitations.
+#
+# These examples use the `nfsuuid` helper available from nfs-utils, see
+# the man page nfsuuid(8).
+#
+# Write the default output of `nfsuuid` to /sys/fs/nfs/net/nfs_client/identifier
+# This either creates a new, random uuid or returns one previously saved:
+# KERNEL=="nfs_client", ATTR{identifier}=="(null)", PROGRAM="/usr/bin/nfsuuid", ATTR{identifier}="%c"
+#
+# Generate a new, random uuid on every boot:
+# KERNEL=="nfs_client", ATTR{identifier}=="(null)", PROGRAM="/usr/bin/nfsuuid -rf/dev/null", ATTR{identifier}="%c"
+#
+# Generate a deterministic uuid based on /etc/machine-id, or return the previously saved one:
+# KERNEL=="nfs_client", ATTR{identifier}=="(null)", PROGRAM="/usr/bin/nfsuuid machine", ATTR{identifier}="%c"
+#
+# Always use a deterministic uuid based on /etc/machine-id:
+# KERNEL=="nfs_client", ATTR{identifier}=="(null)", PROGRAM="/usr/bin/nfsuuid -r machine", ATTR{identifier}="%c"
+#
+# Generate a new, random uuid or return the one previously saved in /var/nfs/client_id:
+# KERNEL=="nfs_client", ATTR{identifier}=="(null)", PROGRAM="/usr/bin/nfsuuid -f/var/nfs/client_id", ATTR{identifier}="%c"