From: Anna Schumaker <anna@kernel.org>
To: linux-nfs@vger.kernel.org, steved@redhat.com
Cc: anna@kernel.org
Subject: [PATCH nfs-utils v2 3/4] rpcctl: Display new rpc_clnt sysfs attributes
Date: Mon, 27 Jan 2025 16:50:55 -0500 [thread overview]
Message-ID: <20250127215056.352658-4-anna@kernel.org> (raw)
In-Reply-To: <20250127215056.352658-1-anna@kernel.org>
From: Anna Schumaker <anna.schumaker@oracle.com>
This includes the rpc program name, rpc version, and maximum number of
connections.
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
---
tools/rpcctl/rpcctl.py | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py
index ce22e424b804..130f245a64e8 100755
--- a/tools/rpcctl/rpcctl.py
+++ b/tools/rpcctl/rpcctl.py
@@ -185,14 +185,13 @@ class Xprt:
class XprtSwitch:
"""Represents a group of xprt connections."""
- def __init__(self, path, sep=":"):
+ def __init__(self, path):
"""Read in xprt switch information from sysfs."""
self.path = path
self.name = path.stem
self.info = read_info_file(path / "xprt_switch_info")
self.xprts = sorted([Xprt(p) for p in self.path.iterdir()
if p.is_dir()])
- self.sep = sep
def __lt__(self, rhs):
"""Compare the name of two xprt switch instances."""
@@ -200,7 +199,7 @@ class XprtSwitch:
def __str__(self):
"""Return a string representation of an xprt switch."""
- switch = f"{self.name}{self.sep} " \
+ switch = f"{self.name}: " \
f"xprts {self.info['num_xprts']}, " \
f"active {self.info['num_active']}, " \
f"queue {self.info['queue_len']}"
@@ -258,7 +257,11 @@ class RpcClient:
"""Read in rpc client information from sysfs."""
self.path = path
self.name = path.stem
- self.switch = XprtSwitch(path / (path / "switch").readlink(), sep=",")
+ self.switch = XprtSwitch(path / (path / "switch").readlink())
+ self.program = read_sysfs_file(path / "program", missing="unknown")
+ self.version = read_sysfs_file(path / "rpc_version", missing="unknown")
+ self.max_connect = read_sysfs_file(path / "max_connect",
+ missing="unknown")
def __lt__(self, rhs):
"""Compare the name of two rpc client instances."""
@@ -266,7 +269,9 @@ class RpcClient:
def __str__(self):
"""Return a string representation of an rpc client."""
- return f"{self.name}: {self.switch}"
+ return f"{self.name}: {self.program}, rpc version {self.version}, " \
+ f"max_connect {self.max_connect}" \
+ f"\n {' ' * len(self.name)}{self.switch}"
def add_command(subparser):
"""Add parser options for the `rpcctl client` command."""
--
2.48.1
next prev parent reply other threads:[~2025-01-27 21:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-27 21:50 [PATCH nfs-utils v2 0/4] rpcctl: Various Improvements Anna Schumaker
2025-01-27 21:50 ` [PATCH nfs-utils v2 1/4] rpcctl: Rename {read,write}_addr_file() Anna Schumaker
2025-01-27 21:50 ` [PATCH nfs-utils v2 2/4] rpcctl: Add support for the xprtsec sysfs attribute Anna Schumaker
2025-01-27 21:50 ` Anna Schumaker [this message]
2025-01-27 21:50 ` [PATCH nfs-utils v2 4/4] rpcctl: Add support for `rpcctl switch add-xprt` Anna Schumaker
2025-02-05 22:23 ` Steve Dickson
2025-02-06 21:44 ` Anna Schumaker
2025-02-07 11:08 ` Steve Dickson
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=20250127215056.352658-4-anna@kernel.org \
--to=anna@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=steved@redhat.com \
/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