From patchwork Mon Jan 27 21:50:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 13951761 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 CFEEE1D9694 for ; Mon, 27 Jan 2025 21:50:58 +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=1738014658; cv=none; b=S9WZhrC6kFyOYbt3asnbz2ycgYlS91yWJRxRtzX9EV9Ltt8RrPhxCk2hL11E6obhKmDhBCiSX6bCZgVA5j4gD9Op/DjVGZcsBUwBPLHgysF6SOrG7MGi93fsSbRAM3C24LlckEFRSZzsCQ3vEIaLUZgs6u/S+PjaNXhKOQIwpF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738014658; c=relaxed/simple; bh=wnw37TjmjrEbZEIqiOgBas0AEzBeDuAHuVq2TkPyywM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RxTtmHPgYNfgFf+r3wDKrwQlhrCpHF1QSfT0Vigmd469ASX5nmdFk1kkHmvMb+1c3rTsh107+7UrqJENlxVNrFq1UnZGitC+6rH4/a2cg6yfw8FOn8CMYozQm0Q1bCr3CJDngrMvX2s7TZlqgu6IBdEx7qpwh7z9avC1f6uwqVc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=V4nV4bru; 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="V4nV4bru" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E80FCC4CEE3; Mon, 27 Jan 2025 21:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738014658; bh=wnw37TjmjrEbZEIqiOgBas0AEzBeDuAHuVq2TkPyywM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V4nV4bru5l/3GtCKRBYHWcUU8HKw+IXXzT2ZpKZvG3wNygZbXM/9jZ3VBKOX5aruK tos/fgdUqhQYbqYUyh40igrNbd3f3+yGbUYrYILi99riI2UXZ4j3fUwnfj9BWbRBlr W3gOyKd5kYUd9qi/HcUFqFquglmxqZdCwxWO+ajwyFeJb0oSZ+OsGcMFXk+/e463On 0KzLWKPLGh2WJC4WN+m9bn33WrDUT6t5NkUJvlPDbKFlgrRjEaxf+JKUArLeZK/ahP ICoqADZYleYd4qpX+5Re6qlCD5JiuEdYKjvrbTEpndH7yJ8CJqe8L1U2vFs0DA6y3y O+izCVhnm3nkA== From: Anna Schumaker To: linux-nfs@vger.kernel.org, steved@redhat.com Cc: anna@kernel.org Subject: [PATCH nfs-utils v2 1/4] rpcctl: Rename {read,write}_addr_file() Date: Mon, 27 Jan 2025 16:50:53 -0500 Message-ID: <20250127215056.352658-2-anna@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127215056.352658-1-anna@kernel.org> References: <20250127215056.352658-1-anna@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Anna Schumaker There is nothing address specific about these functions, so name them something more generic so they can be reused. Signed-off-by: Anna Schumaker --- tools/rpcctl/rpcctl.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py index 0221fbb68be1..654b2f60a894 100755 --- a/tools/rpcctl/rpcctl.py +++ b/tools/rpcctl/rpcctl.py @@ -20,8 +20,8 @@ if not sunrpc.is_dir(): sys.exit(1) -def read_addr_file(path): - """Read an xprt address file.""" +def read_sysfs_file(path): + """Read a sysfs file.""" try: with open(path, 'r') as f: return f.readline().strip() @@ -29,11 +29,11 @@ def read_addr_file(path): return "(enoent)" -def write_addr_file(path, newaddr): - """Write a new address to an xprt address file.""" +def write_sysfs_file(path, input): + """Write 'input' to a sysfs file.""" with open(path, 'w') as f: - f.write(newaddr) - return read_addr_file(path) + f.write(input) + return read_sysfs_file(path) def read_info_file(path): @@ -56,8 +56,8 @@ class Xprt: self.name = path.stem.rsplit("-", 1)[0] self.type = path.stem.split("-")[2] self.info = read_info_file(path / "xprt_info") - self.dstaddr = read_addr_file(path / "dstaddr") - self.srcaddr = read_addr_file(path / "srcaddr") + self.dstaddr = read_sysfs_file(path / "dstaddr") + self.srcaddr = read_sysfs_file(path / "srcaddr") self.read_state() def __lt__(self, rhs): @@ -106,7 +106,7 @@ class Xprt: def set_dstaddr(self, newaddr): """Change the dstaddr of an xprt.""" - self.dstaddr = write_addr_file(self.path / "dstaddr", newaddr) + self.dstaddr = write_sysfs_file(self.path / "dstaddr", newaddr) def set_state(self, state): """Change the state of an xprt.""" From patchwork Mon Jan 27 21:50:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 13951762 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 01D191DA10C for ; Mon, 27 Jan 2025 21:50:58 +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=1738014659; cv=none; b=YJ2PTlTYYStPnH6Rpxb6pzB2YNdYWXwjt8/mBgsOSh5bNlLjEvAoFyekK9IT+CeVesu//FCnhNuAmKJJj8oiJ7bDttL/tr9Xk8fK6blDL4rgkol4t87+LJi0CC7EdByVD0Kt89EBnc5Ez6jaEHlNR7nRadaNPathFvfvwac6PG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738014659; c=relaxed/simple; bh=asilNL2lRfAngpwyYb/PV3k14Z6xGn8aioEZKMBH3ec=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Hjil0MKkxD6CZ+ZTTBWi3A31GNfbulqDXQOlMG+9LWhs1ocysQzIekTHiFoG+7NtmTVRsmIuaiS/2PQCeNx176DuQjPWdqbOd3TEvmkqY5zyzuHJf8lkr0Ni3Ok3KA67rbpG72b8u6nSpFBk0h4Jq/Zpbc/UxfWMYgBq05fYk4I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fZCUCM5o; 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="fZCUCM5o" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F404C4CEE0; Mon, 27 Jan 2025 21:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738014658; bh=asilNL2lRfAngpwyYb/PV3k14Z6xGn8aioEZKMBH3ec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fZCUCM5oLkeWDXlWKrH39d7c6NNHw87+R+iHk4bTdfTfQMXYAPSh/PFduWW9xiw3S hrm+3Zf2SpnaK9aaZpZFFYOQMpfV7lJJZZW4SsHE56XWtM6n7HOS4ukQKd4O4+WOPF dX1CYBJaIIo/+52Bwbj2AhoEw3KBcDqhFLtGQe2ZAith9MnX9Ira3Y5vuJUpRp72Zr tAiRddy+WnHJWJNmswt1dyN+erwvSWHWzpLp76N7HXtTEN4iz+RxwsfLGsKobuBM26 v4ThVvwW3Jc4RXDynM5knA371pHOiKDdJlX7UqFhXd5jqEWj7HNZ6TjKBvyrclRQwI MvxGW3Mbh466Q== From: Anna Schumaker To: linux-nfs@vger.kernel.org, steved@redhat.com Cc: anna@kernel.org Subject: [PATCH nfs-utils v2 2/4] rpcctl: Add support for the xprtsec sysfs attribute Date: Mon, 27 Jan 2025 16:50:54 -0500 Message-ID: <20250127215056.352658-3-anna@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127215056.352658-1-anna@kernel.org> References: <20250127215056.352658-1-anna@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Anna Schumaker This was recently added to the Linux kernel, so running rpcctl on kernels that don't have this attribute will print out "unknown" in its place instead. Signed-off-by: Anna Schumaker --- tools/rpcctl/rpcctl.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py index 654b2f60a894..ce22e424b804 100755 --- a/tools/rpcctl/rpcctl.py +++ b/tools/rpcctl/rpcctl.py @@ -20,13 +20,13 @@ if not sunrpc.is_dir(): sys.exit(1) -def read_sysfs_file(path): +def read_sysfs_file(path, *, missing="enoent"): """Read a sysfs file.""" try: with open(path, 'r') as f: return f.readline().strip() except FileNotFoundError: - return "(enoent)" + return f"({missing})" def write_sysfs_file(path, input): @@ -58,6 +58,7 @@ class Xprt: self.info = read_info_file(path / "xprt_info") self.dstaddr = read_sysfs_file(path / "dstaddr") self.srcaddr = read_sysfs_file(path / "srcaddr") + self.xprtsec = read_sysfs_file(path / "xprtsec", missing="unknown") self.read_state() def __lt__(self, rhs): @@ -67,7 +68,8 @@ class Xprt: def _xprt(self): main = ", main" if self.info.get("main_xprt") else "" return f"{self.name}: {self.type}, {self.dstaddr}, " \ - f"port {self.info['dst_port']}, state <{self.state}>{main}" + f"port {self.info['dst_port']}, sec {self.xprtsec}, " \ + f"state <{self.state}>{main}" def _src_reqs(self): return f" Source: {self.srcaddr}, port {self.info['src_port']}, " \ From patchwork Mon Jan 27 21:50:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 13951763 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 8AC5E1D9694 for ; Mon, 27 Jan 2025 21:50:59 +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=1738014659; cv=none; b=Sq6ROQeiTQT2Ko2ObFhQn3K3Wx+ykVy9RYR/F0r1cpnRb4rXE9MNp1PH4HIn95kVvnNuyTTJKk8n8Ydmcj9yP25jtfNr15mvynBNkkiofbfAxnq3KqutcUzyl3mtoyLWd1SnMEp2Huls05etCPkucQPqJtEl7P04ZvGwVws41vE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738014659; c=relaxed/simple; bh=6Ckg+G1pWZxG0m98V84G/PkldZUA9cgeUo4PkFz9bS8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Cvkn8hL6gswTcf6ZUINvvoHPxrNv65Aaseuegz61QsbWYbPCuSlYpCrflx0aQZs6iOp1JDfcUJ4wCnkuTimPT9OHWjgiwBNbY2z8Lm2ZRWRR7OZfAL7RyHSeLjjZhOtKIB2fCGZmSioOMiabHKAmE93u7JzHoLZncCewJRC+9d8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CXR9mU8k; 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="CXR9mU8k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1934AC4CED2; Mon, 27 Jan 2025 21:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738014659; bh=6Ckg+G1pWZxG0m98V84G/PkldZUA9cgeUo4PkFz9bS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CXR9mU8kokGj6yU1PliaB/9r/5KEgu5x/vASb9X+7KTFJzEdSI0KUHRG0frqmpoMz f59xENvgQwCoGg4EbJSW+4tQCDGYey+Ouvdw1HhXsW/CjdL4UmP+LIxaelG6aTLmMn c0KYRVCVJcZUygmBnjVdtBIU28avwMhhkpRpV/n/juSE0v+OVfZ+0cT1eZtyJFrFJB G3K//Hz1dzbpA/5VZ4lSu04vAnRxnZwwVIy6cqWz7Kds6ebNk2oT4yZLJcw6hQo9vH BSsBMwjK9U0msyMx1xXkM03prECx5O+mXuyiQn9T0Rvr2PmQfmxayEcTKEvQ01GSE2 w+RFEgiV7vDnw== From: Anna Schumaker 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 Message-ID: <20250127215056.352658-4-anna@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127215056.352658-1-anna@kernel.org> References: <20250127215056.352658-1-anna@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Anna Schumaker This includes the rpc program name, rpc version, and maximum number of connections. Signed-off-by: Anna Schumaker --- 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.""" From patchwork Mon Jan 27 21:50:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 13951764 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 8F31D1DAC95 for ; Mon, 27 Jan 2025 21:51:00 +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=1738014660; cv=none; b=hn7mYclO/bj5xvCa+SeEZwwpV2vnV97eblC9d7qhDUgYJzBkbyHR4WPl5Y3WXl4cuZSTaoF46dwcJimBOWLkqeEPoct78c9rmoPeYtDXkQDVn0DBWJSdUhTij+CCk/35FxwYKXHfPj8cA8w9creOvKuCqpUvOe5ejaB/tMT1r4g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738014660; c=relaxed/simple; bh=ksKlAQbUo2hHW6RukwWHjBNOmHlHjfCf5vZtlAfnkZg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f+v54/Pmaxsdl2LCKivZH5VAroB8pP9xlFSZiyxaL4JYz1dwCYZk8+8FTwN67h054ObA99gNGtxPKU9BuCe15K67du+aMkUtHcmM1h7NLlmhg0U6eeV8g3AtBbnA1dIuc+if9qRjvXWrOi125QmY7itQaw08q0zV/CIIQyd0zmk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iSKa9YE1; 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="iSKa9YE1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A33C4C4CEE0; Mon, 27 Jan 2025 21:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738014660; bh=ksKlAQbUo2hHW6RukwWHjBNOmHlHjfCf5vZtlAfnkZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iSKa9YE1aresBZRLuGzwFuO1TdJC8b3+YAS8IAH9NOBRpnWJlx09S602R9SL0nlqL qTfg7O2P6IzDVctBm8d6HM3o6iMia0JFSJOhrwasqMRnbbcKARNDRKOUInK9rp0e+m TILgbmKvoH5d+Y86k1erUanfGbydE9qAcu5JghYem3S7lVi5Lkb1TbE8gW1xy8nCG8 ZuCDZEqEztfwJs5CYN23oFVRdLcU0+VOnMnFQg4BrgJiuNiFN22KJL2EEIZdcJGeKF AZVLy7FW7ryNr2/YHJShh3uEI4PkHOYK2ncYeheE3ohJuG1Am0Lnpho9sC9WkXsLtz Zc8eP/fCWATVg== From: Anna Schumaker To: linux-nfs@vger.kernel.org, steved@redhat.com Cc: anna@kernel.org Subject: [PATCH nfs-utils v2 4/4] rpcctl: Add support for `rpcctl switch add-xprt` Date: Mon, 27 Jan 2025 16:50:56 -0500 Message-ID: <20250127215056.352658-5-anna@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127215056.352658-1-anna@kernel.org> References: <20250127215056.352658-1-anna@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Anna Schumaker This is used to add an xprt to the switch at runtime. Signed-off-by: Anna Schumaker --- tools/rpcctl/rpcctl.man | 4 ++++ tools/rpcctl/rpcctl.py | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/tools/rpcctl/rpcctl.man b/tools/rpcctl/rpcctl.man index b87ba0df41c0..2ee168c8f3c5 100644 --- a/tools/rpcctl/rpcctl.man +++ b/tools/rpcctl/rpcctl.man @@ -12,6 +12,7 @@ rpcctl \- Displays SunRPC connection information .BR "rpcctl client show " "\fR[ \fB\-h \f| \fB\-\-help \fR] [ \fIXPRT \fR]" .P .BR "rpcctl switch" " \fR[ \fB\-h \fR| \fB\-\-help \fR] { \fBset \fR| \fBshow \fR}" +.BR "rpcctl switch add-xprt" " \fR[ \fB\-h \fR| \fB\-\-help \fR] [ \fISWITCH \fR]" .BR "rpcctl switch set" " \fR[ \fB\-h \fR| \fB\-\-help \fR] \fISWITCH \fBdstaddr \fINEWADDR" .BR "rpcctl switch show" " \fR[ \fB\-h \fR| \fB\-\-help \fR] [ \fISWITCH \fR]" .P @@ -29,6 +30,9 @@ Show detailed information about the RPC clients on this system. If \fICLIENT \fRwas provided, then only show information about a single RPC client. .P .SS rpcctl switch \fR- \fBCommands operating on groups of transports +.IP "\fBadd-xprt \fISWITCH" +Add an aditional transport to the \fISWITCH\fR. +Note that the new transport will take its values from the "main" transport. .IP "\fBset \fISWITCH \fBdstaddr \fINEWADDR" Change the destination address of all transports in the \fISWITCH \fRto \fINEWADDR\fR. \fINEWADDR \fRcan be an IP address, DNS name, or anything else resolvable by \fBgethostbyname\fR(3). diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py index 130f245a64e8..29ae7d26f50e 100755 --- a/tools/rpcctl/rpcctl.py +++ b/tools/rpcctl/rpcctl.py @@ -213,6 +213,12 @@ class XprtSwitch: parser.set_defaults(func=XprtSwitch.show, switch=None) subparser = parser.add_subparsers() + add = subparser.add_parser("add-xprt", + help="Add an xprt to the switch") + add.add_argument("switch", metavar="SWITCH", nargs=1, + help="Name of a specific xprt switch to modify") + add.set_defaults(func=XprtSwitch.add_xprt) + show = subparser.add_parser("show", help="Show xprt switches") show.add_argument("switch", metavar="SWITCH", nargs='?', help="Name of a specific switch to show") @@ -236,6 +242,11 @@ class XprtSwitch: return [XprtSwitch(xprt_switches / name)] return [XprtSwitch(f) for f in sorted(xprt_switches.iterdir())] + def add_xprt(args): + """Handle the `rpcctl switch add-xprt` command.""" + for switch in XprtSwitch.get_by_name(args.switch[0]): + write_sysfs_file(switch.path / "add_xprt", "1") + def show(args): """Handle the `rpcctl switch show` command.""" for switch in XprtSwitch.get_by_name(args.switch):