From patchwork Mon Aug 30 15:56:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12465481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D61AC4320A for ; Mon, 30 Aug 2021 15:57:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D88060F42 for ; Mon, 30 Aug 2021 15:57:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237629AbhH3P6A (ORCPT ); Mon, 30 Aug 2021 11:58:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237711AbhH3P5u (ORCPT ); Mon, 30 Aug 2021 11:57:50 -0400 Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3455DC06175F for ; Mon, 30 Aug 2021 08:56:57 -0700 (PDT) Received: by mail-qk1-x731.google.com with SMTP id b64so16315550qkg.0 for ; Mon, 30 Aug 2021 08:56:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TElF6VSe1gc+dQ6uYO+dXFuLYzgXdsWmKiU8G6WAdWc=; b=vDoVqW50vmIsbU/7+07li24efH/bx/mIMkmiZnF4srEFA9RUZV3/idQ6RsztYAT9x5 Y+xYJcmYVFjUiiSmov6YHEFJV98dwitcSfsqS0pvL0shBaMkz7V4XcReNs5hcazMVbco HpSuelFjEGOt6knktnwNdM25AqNs2tDm4uKCyifebuBX3zfldHKiXeYBDi2b/0qnjf8u MLkU0xOLg267YlgzkmYAAi/Dz3oGqqHDDPTxfWG3KHYBYVWbNjP5B1p/qD4tfzCBueiz ddmcqj+gP6k8lL84QdRAZnQUTWXLU59Y4yNTfsEEDgF4rJyKC/71Dd63CVqaULP0UbKd tytQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=TElF6VSe1gc+dQ6uYO+dXFuLYzgXdsWmKiU8G6WAdWc=; b=kCMgzCSB1Ixn090+rVKQGBVv0L4vOhvlq1t+qlq4IMXQWM5FUFV3fz2QyQxR4lIG/E APpibVVirjZg05/xRHqBN+VgLuf704YSPCTCZjkN3xWQFshsZvgEy49vGnjvJtlw051N 6NUPliu3tCD3GPsM2SB2CAkx9Gl/d3D2dRTNAa6i9SH5u7zrE6w2P3r8UambJSvTQNQT 5m9Xc7y+pNT4IIvD5i2o3zV7jHP1a867rvi4NfcTtjh3wrY7nJysYSC4o1QE3LRbKr4o g5K4dsZ2X7ZOroiNRkIFLNdDwIUPnjPkeIbalNZCvRbFwFjEbX/m+3vaIeHgy9zC0ecE Vivw== X-Gm-Message-State: AOAM533HNhuWULyZ9PuHGuHClFxZ7y0LaBp/wWudB3AT0pm6i1FS2Gc5 CUUBcmTvh3yGvhup3UEqC+I= X-Google-Smtp-Source: ABdhPJw7cT8t3cmhbR9odwGnixM2ta4zz0qBKwVf1lRh3sOR9k8JV6aJTu8RKlHGicBg6ZGZnXPpJg== X-Received: by 2002:a05:620a:b83:: with SMTP id k3mr22388363qkh.420.1630339016317; Mon, 30 Aug 2021 08:56:56 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id 12sm8585217qtt.16.2021.08.30.08.56.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 08:56:55 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: steved@redhat.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v3 1/9] nfssysfs: Add a nfssysfs.py tool Date: Mon, 30 Aug 2021 11:56:45 -0400 Message-Id: <20210830155653.1386161-2-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> References: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker This will be used to print and manipulate the sunrpc sysfs directory files. Running without arguments prints both usage information and the location of the sunrpc sysfs directory. Signed-off-by: Anna Schumaker --- v3: Check for type: "sysfs" as the third column in the /proc/mounts file Rename from nfs-sysfs.py to nfssysfs.py --- .gitignore | 2 ++ tools/nfssysfs/nfssysfs.py | 13 +++++++++++++ tools/nfssysfs/sysfs.py | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100755 tools/nfssysfs/nfssysfs.py create mode 100644 tools/nfssysfs/sysfs.py diff --git a/.gitignore b/.gitignore index c89d1cd2583d..a476bd20bc3b 100644 --- a/.gitignore +++ b/.gitignore @@ -84,3 +84,5 @@ systemd/rpc-gssd.service cscope.* # generic editor backup et al *~ +# python bytecode +__pycache__ diff --git a/tools/nfssysfs/nfssysfs.py b/tools/nfssysfs/nfssysfs.py new file mode 100755 index 000000000000..8ff59ea9e81b --- /dev/null +++ b/tools/nfssysfs/nfssysfs.py @@ -0,0 +1,13 @@ +#!/usr/bin/python +import argparse +import sysfs + +parser = argparse.ArgumentParser() + +def show_small_help(args): + parser.print_usage() + print("sunrpc dir:", sysfs.SUNRPC) +parser.set_defaults(func=show_small_help) + +args = parser.parse_args() +args.func(args) diff --git a/tools/nfssysfs/sysfs.py b/tools/nfssysfs/sysfs.py new file mode 100644 index 000000000000..c9d477063585 --- /dev/null +++ b/tools/nfssysfs/sysfs.py @@ -0,0 +1,19 @@ +import pathlib +import re +import sys + +MOUNT = None +with open("/proc/mounts", 'r') as f: + for line in f: + if re.search("^sys ", line): + MOUNT = line.split()[1] + break + +if MOUNT == None: + print("ERROR: sysfs is not mounted") + sys.exit(1) + +SUNRPC = pathlib.Path(MOUNT) / "kernel" / "sunrpc" +if not SUNRPC.is_dir(): + print("ERROR: sysfs does not have sunrpc directory") + sys.exit(1) From patchwork Mon Aug 30 15:56:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12465483 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9666EC43214 for ; Mon, 30 Aug 2021 15:57:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 799FC60ED8 for ; Mon, 30 Aug 2021 15:57:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237711AbhH3P6B (ORCPT ); Mon, 30 Aug 2021 11:58:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237646AbhH3P5w (ORCPT ); Mon, 30 Aug 2021 11:57:52 -0400 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B6F0C061760 for ; Mon, 30 Aug 2021 08:56:58 -0700 (PDT) Received: by mail-qv1-xf2f.google.com with SMTP id gf5so8544647qvb.9 for ; Mon, 30 Aug 2021 08:56:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lys7DtM6lVqjsDSpjgsx9MbdW3F1P43uIMCRhpmes+I=; b=nMmmBa+0UfwTu635oDPevSXe3DGQcaJncAN3ORa1vU/nJ+DwXA71Ed0pokZ1jhhmuB TRMUkAEW8qIxVT1pKPYTh0qhDc1R7nfrv2F3yURGdxrU0mWYWoj0RWywGkcm6nd8nJT7 Aar2xLi7gf1yLUizpddNeb9xXXtbXrjOlI5T78LyUpRamjtLmrL2LWgKcmjdCYXVHEEc tRG8kMLALcVJ5IzVt7JsSFWccxahQZ+IynoysU2kWOp8omq8kvY20RB6cX0+ohC3uHHa YDA9SWkO04igdPNUDGgXfmtam9rMr7zpY/nOEbwGjCwTrPjnizLkUXKM7DJQKTmL5v3c WcgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=lys7DtM6lVqjsDSpjgsx9MbdW3F1P43uIMCRhpmes+I=; b=mLJyz4jD+8z2uH5dRIsxGPzlGXtfcRRyCdgRnkLz35EF2ZoxLJ4/qas7SXJBeLgdbE oHD5/mKlnHntXYY/5At7nZT0mfQu3mzy5ZFBVy8IDDK10UwLJ3kgVf13krtws8zfaCGb fAIKo766V2UAtANm5skEq2/Nhp2XbsD8QUKSoILu0m+nxJiEGPEUzBgQo7POz2vx6/ag Fs534lF/wmgpdmF6UACKwXa9X67t0jtm+IT9hMEQIiE8cSzfMazzNr1vyIPlgdG/UkUN MrT8V/h02biAwWB3BefjJi7OutvjTLxPb3w4MFLbrEroe0zMMJrzZUVrWkuiAlQ/FhQg LjNg== X-Gm-Message-State: AOAM532Ri9z2nRAEk+Lw1nk7ubgB7p/ydmyM/Cf7bednrBM9KRsM2Mz8 5WJJ1ubeOfnFlfej7pWi0G4= X-Google-Smtp-Source: ABdhPJy5exyR9YnUmu2PUQMBHFXIfeyb/C1DX3S7BgrEjDt2dIzBAiJIbr6nYqerKudjfvMBO8sflQ== X-Received: by 2002:ad4:4982:: with SMTP id t2mr7484161qvx.46.1630339017586; Mon, 30 Aug 2021 08:56:57 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id 12sm8585217qtt.16.2021.08.30.08.56.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 08:56:57 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: steved@redhat.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v3 2/9] nfssysfs.py: Add a command for printing xprt switch information Date: Mon, 30 Aug 2021 11:56:46 -0400 Message-Id: <20210830155653.1386161-3-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> References: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker This combines the information found in xprt_switch_info with a subset of the information found in each xprt subdirectory Signed-off-by: Anna Schumaker --- tools/nfssysfs/nfssysfs.py | 6 ++++++ tools/nfssysfs/switch.py | 35 +++++++++++++++++++++++++++++++++++ tools/nfssysfs/sysfs.py | 10 ++++++++++ tools/nfssysfs/xprt.py | 12 ++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 tools/nfssysfs/switch.py create mode 100644 tools/nfssysfs/xprt.py diff --git a/tools/nfssysfs/nfssysfs.py b/tools/nfssysfs/nfssysfs.py index 8ff59ea9e81b..90efcbed7ac8 100755 --- a/tools/nfssysfs/nfssysfs.py +++ b/tools/nfssysfs/nfssysfs.py @@ -9,5 +9,11 @@ def show_small_help(args): print("sunrpc dir:", sysfs.SUNRPC) parser.set_defaults(func=show_small_help) + +import switch +subparser = parser.add_subparsers(title="commands") +switch.add_command(subparser) + + args = parser.parse_args() args.func(args) diff --git a/tools/nfssysfs/switch.py b/tools/nfssysfs/switch.py new file mode 100644 index 000000000000..afb6963a0a1f --- /dev/null +++ b/tools/nfssysfs/switch.py @@ -0,0 +1,35 @@ +import sysfs +import xprt + +class XprtSwitch: + def __init__(self, path): + self.path = path + self.id = int(str(path).rsplit("-", 1)[1]) + + self.xprts = [ xprt.Xprt(p) for p in self.path.iterdir() if p.is_dir() ] + self.xprts.sort() + + self.__dict__.update(sysfs.read_info_file(path / "xprt_switch_info")) + + def __lt__(self, rhs): + return self.path < rhs.path + + def __str__(self): + line = "switch %s: num_xprts %s, num_active %s, queue_len %s" % \ + (self.id, self.num_xprts, self.num_active, self.queue_len) + for x in self.xprts: + line += "\n %s" % x.small_str() + return line + + +def list_xprt_switches(args): + switches = [ XprtSwitch(f) for f in (sysfs.SUNRPC / "xprt-switches").iterdir() ] + switches.sort() + for xs in switches: + if args.id == None or xs.id == args.id[0]: + print(xs) + +def add_command(subparser): + parser = subparser.add_parser("xprt-switch", help="Commands for xprt switches") + parser.add_argument("--id", metavar="ID", nargs=1, type=int, help="Id of a specific xprt-switch to show") + parser.set_defaults(func=list_xprt_switches) diff --git a/tools/nfssysfs/sysfs.py b/tools/nfssysfs/sysfs.py index c9d477063585..79f844af34a6 100644 --- a/tools/nfssysfs/sysfs.py +++ b/tools/nfssysfs/sysfs.py @@ -17,3 +17,13 @@ SUNRPC = pathlib.Path(MOUNT) / "kernel" / "sunrpc" if not SUNRPC.is_dir(): print("ERROR: sysfs does not have sunrpc directory") sys.exit(1) + + +def read_info_file(path): + res = dict() + with open(path) as info: + for line in info: + if "=" in line: + (key, val) = line.strip().split("=") + res[key] = int(val) + return res diff --git a/tools/nfssysfs/xprt.py b/tools/nfssysfs/xprt.py new file mode 100644 index 000000000000..d37537771c1d --- /dev/null +++ b/tools/nfssysfs/xprt.py @@ -0,0 +1,12 @@ +class Xprt: + def __init__(self, path): + self.path = path + self.id = int(str(path).rsplit("-", 2)[1]) + self.type = str(path).rsplit("-", 2)[2] + self.dstaddr = open(path / "dstaddr", 'r').readline().strip() + + def __lt__(self, rhs): + return self.id < rhs.id + + def small_str(self): + return "xprt %s: %s, %s" % (self.id, self.type, self.dstaddr) From patchwork Mon Aug 30 15:56:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12465487 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7241C43214 for ; Mon, 30 Aug 2021 15:57:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA03860F42 for ; Mon, 30 Aug 2021 15:57:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237799AbhH3P6B (ORCPT ); Mon, 30 Aug 2021 11:58:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237732AbhH3P5y (ORCPT ); Mon, 30 Aug 2021 11:57:54 -0400 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CCEBC061764 for ; Mon, 30 Aug 2021 08:56:59 -0700 (PDT) Received: by mail-qv1-xf35.google.com with SMTP id a5so8627489qvq.0 for ; Mon, 30 Aug 2021 08:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W/8NtlacI5WS71LaySwODmC9q+ANEoOEYf3Bcg7kaCo=; b=thy3TORRQJ3CXvMotWkAMxUzAbY59LsVoYVopjI1S7EDeh9hrcQAnR4N5xQ0HdptOc PnrjK4AtWkWFaT2zuS7mBwl1lyn6YR+TU4ijuStJhN8Z5YhSOePehOhDUO0byjLxkPtn kSqCvtXXADw4XwMz1EPJDrEK8qioXpj+D2BKn1Iom0Md/ZrR0C2sUAzQKSPzNWjfKIIc AyRvF1wFnrnhcaOT+WsFV8RLaqwRlHXgqkm0ZXaFAfrM6Hklt6x6R0GChsCVBE7GATVu s8R4IvRTs5f6PWwzYmUO7XC4WAorjfPLHu8yITm+FuEinqidxZ3dlWFAuLksQzcoJnV4 5gEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=W/8NtlacI5WS71LaySwODmC9q+ANEoOEYf3Bcg7kaCo=; b=f9o5AtUUgD3ty0fVBhPPcXsxLRqZc83gVarsFGvmHWE0JtebQ7zGyIqVHF3GR+nHW2 ZXae4oSeuMvQaTgt6ESU6ykk0kOR66uGC51IM5TQigG0DzhmA/K82bIoOzjcjfJJRPR2 lX0/+/Yjc7a/fZF366RrRZ+LnPKhbKFmo0JEvuBmEDZC64ohhYsJQ0zKwAhEtQ80O/R7 VW74lyIIGew4UKhbH3DrBve0b37xq8oUBGvz6IaRPx14EbfHaFIvs9qap6+ppCqad1La uRSljkbmW9fZCzdtUYVFlDrd34/fYk391gwrjYjRJgUJWpkHd8AwNMTr7MmKoOB/yxJC iqRQ== X-Gm-Message-State: AOAM533pcTem7U+tREUA8JaBbKm78UWTh9yfhpesDsSrBGYR0hoRtyw2 S1bKJ5zX6Dyy5Hau5Jm+ZLc= X-Google-Smtp-Source: ABdhPJzBYZJuzBIzblYnnGUpp6xh1Ywi3zx6Tu/wGT6bkXjQdIpcRRDKCrGhxuUS22BdzkEdzdTKwQ== X-Received: by 2002:ad4:4f86:: with SMTP id em6mr23625697qvb.7.1630339018672; Mon, 30 Aug 2021 08:56:58 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id 12sm8585217qtt.16.2021.08.30.08.56.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 08:56:58 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: steved@redhat.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v3 3/9] nfssysfs.py: Add a command for printing individual xprts Date: Mon, 30 Aug 2021 11:56:47 -0400 Message-Id: <20210830155653.1386161-4-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> References: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker This shows more detailed information than what is presented with xprt switches. I take the chance to add a main-export indicator to the small_str() used when printing out xprt-switches. Signed-off-by: Anna Schumaker --- tools/nfssysfs/nfssysfs.py | 2 ++ tools/nfssysfs/xprt.py | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/tools/nfssysfs/nfssysfs.py b/tools/nfssysfs/nfssysfs.py index 90efcbed7ac8..dfad6ac08fa0 100755 --- a/tools/nfssysfs/nfssysfs.py +++ b/tools/nfssysfs/nfssysfs.py @@ -11,8 +11,10 @@ parser.set_defaults(func=show_small_help) import switch +import xprt subparser = parser.add_subparsers(title="commands") switch.add_command(subparser) +xprt.add_command(subparser) args = parser.parse_args() diff --git a/tools/nfssysfs/xprt.py b/tools/nfssysfs/xprt.py index d37537771c1d..fbdd9bfc9375 100644 --- a/tools/nfssysfs/xprt.py +++ b/tools/nfssysfs/xprt.py @@ -1,12 +1,48 @@ +import sysfs + class Xprt: def __init__(self, path): self.path = path self.id = int(str(path).rsplit("-", 2)[1]) self.type = str(path).rsplit("-", 2)[2] self.dstaddr = open(path / "dstaddr", 'r').readline().strip() + self.srcaddr = open(path / "srcaddr", 'r').readline().strip() + + with open(path / "xprt_state") as f: + self.state = ','.join(f.readline().split()[1:]) + self.__dict__.update(sysfs.read_info_file(path / "xprt_info")) def __lt__(self, rhs): return self.id < rhs.id + def __str__(self): + state = self.state + if self.main_xprt: + state = "MAIN," + self.state + + line = "xprt %s: %s, %s, port %s, state <%s>" % \ + (self.id, self.type, self.dstaddr, self.dst_port, state) + line += "\n Source: %s, port %s, Requests: %s" % \ + (self.srcaddr, self.src_port, self.num_reqs) + line += "\n Congestion: cur %s, win %s, Slots: min %s, max %s" % \ + (self.cur_cong, self.cong_win, self.min_num_slots, self.max_num_slots) + line += "\n Queues: binding %s, sending %s, pending %s, backlog %s, tasks %s" % \ + (self.binding_q_len, self.sending_q_len, self.pending_q_len, self.backlog_q_len, self.tasks_queuelen) + return line + def small_str(self): - return "xprt %s: %s, %s" % (self.id, self.type, self.dstaddr) + return "xprt %s: %s, %s%s" % (self.id, self.type, self.dstaddr, + f" [main]" if self.main_xprt else "" ) + + +def list_xprts(args): + xprts = [ Xprt(f) for f in (sysfs.SUNRPC / "xprt-switches").glob("**/xprt-*") ] + xprts.sort() + for xprt in xprts: + if args.id == None or xprt.id == args.id[0]: + print(xprt) + +def add_command(subparser): + parser = subparser.add_parser("xprt", help="Commands for individual xprts") + parser.add_argument("--id", metavar="ID", nargs=1, type=int, help="Id of a specific xprt to show") + parser.set_defaults(func=list_xprts) From patchwork Mon Aug 30 15:56:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12465489 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4EAAC4320A for ; Mon, 30 Aug 2021 15:57:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8ED9460F42 for ; Mon, 30 Aug 2021 15:57:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237815AbhH3P6C (ORCPT ); Mon, 30 Aug 2021 11:58:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237723AbhH3P5y (ORCPT ); Mon, 30 Aug 2021 11:57:54 -0400 Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD0F4C0613D9 for ; Mon, 30 Aug 2021 08:57:00 -0700 (PDT) Received: by mail-qk1-x72e.google.com with SMTP id m21so16120670qkm.13 for ; Mon, 30 Aug 2021 08:57:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2HQsV1Lb5bqQh7jnJ54wWFpeDSoRXnVa5uQ5o2BzLvY=; b=Dq43En5lhA7sREJRIjZzwUH6Lxa+2LncoznjU+M8ED/cpFtcBht0bqg3yHa737WAP/ OXoTZ3mg8mWkcGS/bYa6v7QJSV4gVxZFpZpFd9LPcBcZ71M6WTIS1U+TtVcerQcGWa+z YMB+zj3U6JtPhUo3+rpMKbEWTiNdtrnrwgXyyWim5lxlFQlOkoH5HvHneRcOiX/fxSZ7 vnvdso/o1p1U2aXWa7UdZz2yPoVkQ2OflcUD+/oH5TqUCaUeVI/DuZ4UoMYc2YkWsmsd 0AKUGSru2xqgA9olRUuyEt7/uR57JjcWTDW+3t6osfF/Vn3MAd22DrPdSGTA9I4/jMsp UDng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=2HQsV1Lb5bqQh7jnJ54wWFpeDSoRXnVa5uQ5o2BzLvY=; b=DNPZT6oRCC/6h5wXg1nTopP4bvIuLY+f3UoDcmvpWuwBRNw04+fYmr7A9PO+EFSvYd PDuWNmbVjeoW1hL/XvUyyNBd96/BJ5U2kb1pqQ0c3uv0GjxJKCNiElMvzixbdgmnuuqr jJBGQZ3cYYPXot6PQByi5Qw7pwh1BOsxh3om5xaUmu1fhk0QNgh7DrwDxvbPZgUAZlGV Fr17RGos/2WRT5oeorfVUQIa3HfAuSz8huBM9nEe5RhVrbYx3rIy4LncPsc8jB3i5Vu9 nNcIE5k7+rW9I02s3rx2HkKTeaFAxNmKQDzdJidc3QdJLhBdWxmEv31+NZO4CyLSk2uQ /t+w== X-Gm-Message-State: AOAM532zUbG+WcvqY2XZ9PVpeYF09BaX5kHAV8oli1FRTcFLh/L9Ikp8 +4YHbw+GGNY0buOD/XrK0fgVdckUJwt0xQ== X-Google-Smtp-Source: ABdhPJw5BQsgz01CzLbk+utiNpYiXUYYwgEHRSQQuQcQr/lzrrDc1GH/iFHfnCVHeLeisL/0IFlNpw== X-Received: by 2002:a37:989:: with SMTP id 131mr23919007qkj.472.1630339019776; Mon, 30 Aug 2021 08:56:59 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id 12sm8585217qtt.16.2021.08.30.08.56.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 08:56:59 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: steved@redhat.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v3 4/9] nfssysfs.py: Add a command for printing rpc-client information Date: Mon, 30 Aug 2021 11:56:48 -0400 Message-Id: <20210830155653.1386161-5-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> References: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker It's mostly the same information as with xprt-switches, except with rpc-client id prepended to the first line. Signed-off-by: Anna Schumaker --- tools/nfssysfs/client.py | 27 +++++++++++++++++++++++++++ tools/nfssysfs/nfssysfs.py | 2 ++ tools/nfssysfs/switch.py | 7 ++++--- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 tools/nfssysfs/client.py diff --git a/tools/nfssysfs/client.py b/tools/nfssysfs/client.py new file mode 100644 index 000000000000..5192cc226aed --- /dev/null +++ b/tools/nfssysfs/client.py @@ -0,0 +1,27 @@ +import sysfs +import switch + +class RpcClient: + def __init__(self, path): + self.path = path + self.id = int(str(path).rsplit("-", 1)[1]) + self.switch = switch.XprtSwitch(path / (path / "switch").readlink(), sep=",") + + def __lt__(self, rhs): + return self.id < rhs.id + + def __str__(self): + return "client %s: %s" % (self.id, self.switch) + + +def list_rpc_clients(args): + clients = [ RpcClient(f) for f in (sysfs.SUNRPC / "rpc-clients").iterdir() ] + clients.sort() + for client in clients: + if args.id == None or client.id == args.id[0]: + print(client) + +def add_command(subparser): + parser = subparser.add_parser("rpc-client", help="Commands for rpc clients") + parser.add_argument("--id", metavar="ID", nargs=1, type=int, help="Id of a specific client to show") + parser.set_defaults(func=list_rpc_clients) diff --git a/tools/nfssysfs/nfssysfs.py b/tools/nfssysfs/nfssysfs.py index dfad6ac08fa0..e2172cdfa4c1 100755 --- a/tools/nfssysfs/nfssysfs.py +++ b/tools/nfssysfs/nfssysfs.py @@ -10,9 +10,11 @@ def show_small_help(args): parser.set_defaults(func=show_small_help) +import client import switch import xprt subparser = parser.add_subparsers(title="commands") +client.add_command(subparser) switch.add_command(subparser) xprt.add_command(subparser) diff --git a/tools/nfssysfs/switch.py b/tools/nfssysfs/switch.py index afb6963a0a1f..5384f970235c 100644 --- a/tools/nfssysfs/switch.py +++ b/tools/nfssysfs/switch.py @@ -2,9 +2,10 @@ import sysfs import xprt class XprtSwitch: - def __init__(self, path): + def __init__(self, path, sep=":"): self.path = path self.id = int(str(path).rsplit("-", 1)[1]) + self.sep = sep self.xprts = [ xprt.Xprt(p) for p in self.path.iterdir() if p.is_dir() ] self.xprts.sort() @@ -15,8 +16,8 @@ class XprtSwitch: return self.path < rhs.path def __str__(self): - line = "switch %s: num_xprts %s, num_active %s, queue_len %s" % \ - (self.id, self.num_xprts, self.num_active, self.queue_len) + line = "switch %s%s num_xprts %s, num_active %s, queue_len %s" % \ + (self.id, self.sep, self.num_xprts, self.num_active, self.queue_len) for x in self.xprts: line += "\n %s" % x.small_str() return line From patchwork Mon Aug 30 15:56:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12465491 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF951C432BE for ; Mon, 30 Aug 2021 15:57:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA14860F42 for ; Mon, 30 Aug 2021 15:57:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237723AbhH3P6D (ORCPT ); Mon, 30 Aug 2021 11:58:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237526AbhH3P57 (ORCPT ); Mon, 30 Aug 2021 11:57:59 -0400 Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D2ACC061796 for ; Mon, 30 Aug 2021 08:57:01 -0700 (PDT) Received: by mail-qv1-xf33.google.com with SMTP id gf5so8544721qvb.9 for ; Mon, 30 Aug 2021 08:57:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HiRxPZuzFnyvuD5q3Dy856rG1m2Sv7MpUGVlgQKyeBA=; b=KEuZH9h9n8os/Lp6LxzQ5f/ahxJ1zF7IVosBWhESBfBJqH4uj/+Cy1h88wP8UpB3qx EDGq+jYWd/TDzqu3FAYZjDLnqx++i5J8f9XuNWdka/wRoFsx78dWdV7NVAZ7Vr2754SW I7IdmMf+qcdRUNrXsizmwIRVSSS/dDDwqqqrFIowuO5YLqhIbDg7Xf5gGTaknRG8ilXH 4+huxzXHViEatiYyStUaGaGmMYCgx10hiRXCm2csxyXJOwrDY6s+s30zZQd/q/Jx+Wpj hkXaJzCEGK1g6MSWVBehKzuCtHiau1WT8d18SoQ5IeLYl1sHfBXd+0M9w6CMOcJFTbfp B5Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=HiRxPZuzFnyvuD5q3Dy856rG1m2Sv7MpUGVlgQKyeBA=; b=LbMIdBUCrYtQJQFalH72Q5LY8KDewPFms+SmYweq2bAxOUxRko8lNoOm3dS7zmdO6I n3IW+BxXwJ709zFWsbmqgwN9c8hEEW6mQCqpS+6nBUONAJL/E4OIQWEYNclUy2VCtHOm ENHxNLQmNiy/DN3L9FkpQYocKQJUBaN1ryj3y8OXFC1ETC/posJpDw98aQvVZfVkma9r plmY0jcuCIrgK6okOo1puk2KtQTMUaaVhNfxguD0royAa8I+3O3jxtQHvC3kknoMhMHb KAoAC0dWFIUAxVmU4Vfb111s1yVJ6y+HG5/5T+swzdwcyNN9F8Vz4EGGbqh2C+Cvuybc Q0yw== X-Gm-Message-State: AOAM530lzKOtJTqfcs9b1kQvQ1Ifnb0BCn16DUH327wDwYw0+w0xfU8D gUW/mMJ7WmzRqhDUw3a5wUU= X-Google-Smtp-Source: ABdhPJw5V7aLABXHhRw54PgqzuyWPNtH4isZyib1MLFNjOahopiLDW88hG5E5IlPOIpG9cl1hLvOzw== X-Received: by 2002:a0c:aac5:: with SMTP id g5mr19459216qvb.23.1630339020728; Mon, 30 Aug 2021 08:57:00 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id 12sm8585217qtt.16.2021.08.30.08.56.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 08:57:00 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: steved@redhat.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v3 5/9] nfssysfs.py: Add a command for changing xprt dstaddr Date: Mon, 30 Aug 2021 11:56:49 -0400 Message-Id: <20210830155653.1386161-6-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> References: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker Using the socket module for dns resolution Signed-off-by: Anna Schumaker --- tools/nfssysfs/xprt.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tools/nfssysfs/xprt.py b/tools/nfssysfs/xprt.py index fbdd9bfc9375..2160cb0a9575 100644 --- a/tools/nfssysfs/xprt.py +++ b/tools/nfssysfs/xprt.py @@ -1,3 +1,4 @@ +import socket import sysfs class Xprt: @@ -34,6 +35,12 @@ class Xprt: return "xprt %s: %s, %s%s" % (self.id, self.type, self.dstaddr, f" [main]" if self.main_xprt else "" ) + def set_dstaddr(self, newaddr): + resolved = socket.gethostbyname(newaddr) + with open(self.path / "dstaddr", 'w') as f: + f.write(resolved) + self.dstaddr = open(self.path / "dstaddr", 'r').readline().strip() + def list_xprts(args): xprts = [ Xprt(f) for f in (sysfs.SUNRPC / "xprt-switches").glob("**/xprt-*") ] @@ -42,7 +49,28 @@ def list_xprts(args): if args.id == None or xprt.id == args.id[0]: print(xprt) +def get_xprt(id): + xprts = [ Xprt(f) for f in (sysfs.SUNRPC / "xprt-switches").glob("**/xprt-*") ] + for xprt in xprts: + if xprt.id == id: + return xprt + +def set_xprt_property(args): + xprt = get_xprt(args.id[0]) + try: + if args.dstaddr != None: + xprt.set_dstaddr(args.dstaddr[0]) + print(xprt) + except Exception as e: + print(e) + def add_command(subparser): parser = subparser.add_parser("xprt", help="Commands for individual xprts") parser.add_argument("--id", metavar="ID", nargs=1, type=int, help="Id of a specific xprt to show") parser.set_defaults(func=list_xprts) + + subparser = parser.add_subparsers() + parser = subparser.add_parser("set", help="Set an xprt property") + parser.add_argument("--id", metavar="ID", nargs=1, type=int, required=True, help="Id of a specific xprt to modify") + parser.add_argument("--dstaddr", metavar="dstaddr", nargs=1, type=str, help="New dstaddr to set") + parser.set_defaults(func=set_xprt_property) From patchwork Mon Aug 30 15:56:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12465495 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FD0CC19F35 for ; Mon, 30 Aug 2021 15:57:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E8F4D60F56 for ; Mon, 30 Aug 2021 15:57:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237625AbhH3P6F (ORCPT ); Mon, 30 Aug 2021 11:58:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237590AbhH3P57 (ORCPT ); Mon, 30 Aug 2021 11:57:59 -0400 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4E13C06179A for ; Mon, 30 Aug 2021 08:57:02 -0700 (PDT) Received: by mail-qv1-xf2f.google.com with SMTP id eh1so8529269qvb.11 for ; Mon, 30 Aug 2021 08:57:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E+XWwc8WLAi42CxnfebvJJpuOJJi6MzDVmVeD37GxZc=; b=F7wptt09vxRVT4EUcKx7YqpM5G7OphNG5Nyy2+5czl1CYptX9q2fcrV8++0BlwqSU5 iclYIMikXRBWOkQL5oRh6zgpBdXoHBCdxSlACMw1iQcay7WnyhvUpnxqzbFyRYyQMT3m 4gnNjEbRaAaVudFHBRBjFcDd8/efR8HLWi1pyUU4ihy/kTRce3Dgy65h7iqd5QVyXo3G JzcdU4yjWk7bOSX7oLwKYKxeqo8Kg2LaZJQ++n6teir5APX/Wfbf+FDz+VRyZUdIF0Og A0uaHDC0Faq+Ia4zj3yS57W5Lo05RDvEAnts49MsqRs+LrSTF4VJdaYWZrLzJhqNxmVb QtFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=E+XWwc8WLAi42CxnfebvJJpuOJJi6MzDVmVeD37GxZc=; b=XVkVOwGva4gJKovOkmmyHNywuMKCz4+F5X9P+JukkYFnvK5JT4Uwfc0SnDhsZXnYel PvQy6Zrs8lrGZuE5pN92aLl7j0EXtNKe32cKC2xA2Ip8YRn5VXimz2YI45wOSvRkxeuc vDdtTMbprYhLRGElvYrNMjWXcbmC/EYafWGXiQXGMVVoQinRExwaq09SmWIPJOM+T28I Hf0WGLIf6zSEOVO0Dga/olTyzMz2R5NsgjrC0dt/j8CRzZXDu5VGcc483PMMj3IJQGwk QIAyw7LiSygUhBcioK8UiFQzwDCkE3qEFL/hS25PHLEh0uS57yAkqS65rJrs6zO35c0F C52Q== X-Gm-Message-State: AOAM5333oW/MAonwl5hTPnOqyWUW5rauW0DTcGa+itqkfImQCitYeQ8q jqonDgkmQbrSAzasbfwEvpE= X-Google-Smtp-Source: ABdhPJyX8XUEHloNIzeaHv2Jo4OGWx20sZOUygGxLizHEuuz/USncgtwH7bm/Bk3rSHAaq2aKnRb/g== X-Received: by 2002:a0c:e412:: with SMTP id o18mr21462680qvl.57.1630339021978; Mon, 30 Aug 2021 08:57:01 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id 12sm8585217qtt.16.2021.08.30.08.57.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 08:57:01 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: steved@redhat.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v3 6/9] nfssysfs.py: Add a command for changing xprt-switch dstaddrs Date: Mon, 30 Aug 2021 11:56:50 -0400 Message-Id: <20210830155653.1386161-7-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> References: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker This is basically the same as for xprts, but it iterates through all xprts attached to the switch to apply the new address. Signed-off-by: Anna Schumaker --- tools/nfssysfs/switch.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/nfssysfs/switch.py b/tools/nfssysfs/switch.py index 5384f970235c..859b82e07895 100644 --- a/tools/nfssysfs/switch.py +++ b/tools/nfssysfs/switch.py @@ -30,7 +30,22 @@ def list_xprt_switches(args): if args.id == None or xs.id == args.id[0]: print(xs) +def set_xprt_switch_property(args): + switch = XprtSwitch(sysfs.SUNRPC / "xprt-switches" / f"switch-{args.id[0]}") + try: + for xprt in switch.xprts: + xprt.set_dstaddr(args.dstaddr[0]) + print(switch) + except Exception as e: + print(e) + def add_command(subparser): parser = subparser.add_parser("xprt-switch", help="Commands for xprt switches") parser.add_argument("--id", metavar="ID", nargs=1, type=int, help="Id of a specific xprt-switch to show") parser.set_defaults(func=list_xprt_switches) + + subparser = parser.add_subparsers() + parser = subparser.add_parser("set", help="Set an xprt switch property") + parser.add_argument("--id", metavar="ID", nargs=1, type=int, required=True, help="Id of an xprt-switch to modify") + parser.add_argument("--dstaddr", metavar="dstaddr", nargs=1, type=str, help="New dstaddr to set") + parser.set_defaults(func=set_xprt_switch_property) From patchwork Mon Aug 30 15:56:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12465497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5D29C43214 for ; Mon, 30 Aug 2021 15:57:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 933E260F56 for ; Mon, 30 Aug 2021 15:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237814AbhH3P6G (ORCPT ); Mon, 30 Aug 2021 11:58:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237691AbhH3P6A (ORCPT ); Mon, 30 Aug 2021 11:58:00 -0400 Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA0C7C0617A8 for ; Mon, 30 Aug 2021 08:57:03 -0700 (PDT) Received: by mail-qk1-x72a.google.com with SMTP id c10so16120582qko.11 for ; Mon, 30 Aug 2021 08:57:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nn0vCR8th2Ujh0diRLRkmzEOc/OiB5yqXqEnV1zuwXk=; b=aofICgMPQWnGwrioK9GaQkdCccbfs6Flt0dnoj46BJ074xyh+3bvs0fq9FU/KW3hFm hSeMuGi0GTVCfBfjWh5idwKul21c/q01/ptnHcUz8TjqFtaruLbqZ4PMYDI47uUuVBYI Zx28BfcsaM47fimlKiqOPPxOrICKnqWQ2FHNSp4/N2Afy6P2wdJvtC3ucCZqK04DpdIy qMyqgTmU5V2nwAWFJDfN6Uk3yrg3t+JQrd+alUcejsQnMP3rnEmwUg9dtAhnwaxfKxmX XtMQSRogYsGGXUlFC+Biv7Hpp4Wvt+mT8WZ6836VgDh21KXVesp/LmCv4imbEdjaV6pd tU9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=nn0vCR8th2Ujh0diRLRkmzEOc/OiB5yqXqEnV1zuwXk=; b=nObRvIDXZ+atoCnqgJ6nID55/ylJE4Mp38YhIGh0NuYvxee7naHsQtErC3ohzIO3jJ Sy8xIRu/4Sy3O0gcB98OTfWsfHxUpqiwXrb4Cq3TLU3S0eSLWw7JSmdrn99fH/P0OXmL YkuRLudMgMF0iQqyqRXuD85BrLd0oS8Nb2eHG/jljBgTsd3F2Bbs9OyDpYTF3PFBU3wh ASlHb0++B4N5S1eoAhBYseHkl2e2elmxr723BpAI4bi/dLEEDccgO2MRU+4h7BaF4tm8 z8Hk8YRSStxMUVHPscWEraEROQsICTWU73YC4Sj4RUJNHcXBdMNRIfZjCN2rCvdMNd4/ JuAQ== X-Gm-Message-State: AOAM5311vmlz1kMSyLzg/ARdO/xKbj8FFSZMyBP/pq7jcLey1Q+1hnF/ zXpMYyO3NiTsfGVhJj2RVcuM/QMINgWexA== X-Google-Smtp-Source: ABdhPJwWSvX2iFR6/huuk//RioehfKwWwFu6Dh0do4Qw7RVD2nPpAo+l7gPxxpH3RIJDqZgzbVPLsQ== X-Received: by 2002:a05:620a:799:: with SMTP id 25mr22807928qka.119.1630339022912; Mon, 30 Aug 2021 08:57:02 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id 12sm8585217qtt.16.2021.08.30.08.57.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 08:57:02 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: steved@redhat.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v3 7/9] nfssysfs.py: Add a command for changing xprt state Date: Mon, 30 Aug 2021 11:56:51 -0400 Message-Id: <20210830155653.1386161-8-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> References: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker We can set it offline or online, or we can remove an xprt. The kernel only supports removing offlined transports, so we make sure to set the state to "offline" before sending the remove command. Signed-off-by: Anna Schumaker --- v3: Don't compare booleans against True / False --- tools/nfssysfs/xprt.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/tools/nfssysfs/xprt.py b/tools/nfssysfs/xprt.py index 2160cb0a9575..9426c99dae2b 100644 --- a/tools/nfssysfs/xprt.py +++ b/tools/nfssysfs/xprt.py @@ -8,15 +8,18 @@ class Xprt: self.type = str(path).rsplit("-", 2)[2] self.dstaddr = open(path / "dstaddr", 'r').readline().strip() self.srcaddr = open(path / "srcaddr", 'r').readline().strip() + self.exists = True - with open(path / "xprt_state") as f: - self.state = ','.join(f.readline().split()[1:]) + self.read_state() self.__dict__.update(sysfs.read_info_file(path / "xprt_info")) def __lt__(self, rhs): return self.id < rhs.id def __str__(self): + if not self.exists: + return "xprt %s: has been removed" % self.id + state = self.state if self.main_xprt: state = "MAIN," + self.state @@ -31,6 +34,13 @@ class Xprt: (self.binding_q_len, self.sending_q_len, self.pending_q_len, self.backlog_q_len, self.tasks_queuelen) return line + def read_state(self): + if not self.path.exists(): + self.exists = False + return + with open(self.path / "xprt_state") as f: + self.state = ','.join(f.readline().split()[1:]) + def small_str(self): return "xprt %s: %s, %s%s" % (self.id, self.type, self.dstaddr, f" [main]" if self.main_xprt else "" ) @@ -41,6 +51,11 @@ class Xprt: f.write(resolved) self.dstaddr = open(self.path / "dstaddr", 'r').readline().strip() + def set_state(self, state): + with open(self.path / "xprt_state", 'w') as f: + f.write(state) + self.read_state() + def list_xprts(args): xprts = [ Xprt(f) for f in (sysfs.SUNRPC / "xprt-switches").glob("**/xprt-*") ] @@ -60,6 +75,13 @@ def set_xprt_property(args): try: if args.dstaddr != None: xprt.set_dstaddr(args.dstaddr[0]) + if args.offline: + xprt.set_state("offline") + elif args.online: + xprt.set_state("online") + elif args.remove: + xprt.set_state("offline") + xprt.set_state("remove") print(xprt) except Exception as e: print(e) @@ -73,4 +95,7 @@ def add_command(subparser): parser = subparser.add_parser("set", help="Set an xprt property") parser.add_argument("--id", metavar="ID", nargs=1, type=int, required=True, help="Id of a specific xprt to modify") parser.add_argument("--dstaddr", metavar="dstaddr", nargs=1, type=str, help="New dstaddr to set") + parser.add_argument("--offline", action="store_true", help="Set an xprt offline") + parser.add_argument("--online", action="store_true", help="Set an offline xprt back online") + parser.add_argument("--remove", action="store_true", help="Remove an xprt") parser.set_defaults(func=set_xprt_property) From patchwork Mon Aug 30 15:56:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12465493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11AC3C4320A for ; Mon, 30 Aug 2021 15:57:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F2AFD60F42 for ; Mon, 30 Aug 2021 15:57:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237691AbhH3P6H (ORCPT ); Mon, 30 Aug 2021 11:58:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237715AbhH3P6A (ORCPT ); Mon, 30 Aug 2021 11:58:00 -0400 Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5780C0617AD for ; Mon, 30 Aug 2021 08:57:04 -0700 (PDT) Received: by mail-qv1-xf2a.google.com with SMTP id p17so4221056qvo.8 for ; Mon, 30 Aug 2021 08:57:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=khaGAdaqkWaatpF0Kr1qGQR60qUuZJKnbxVAZoCcDPU=; b=DRWBk6KrNAGd3miemOOusADfRSBa+0qqOoEBegfCwQy3CadxFwEyRKXBf6gg2mkIWJ onJzfwD6h4UiwvDbarXWbuu5x0IUPVpbmLerP9GC8+qyYx/uTdkPn4N+sSlgN+0qs9Pu qx5hQWk8XWts5CpVG+PgercUYSuq3IY2yn/8vSuYng0bUnXuqJJfoh5oAhgnyUP1O1ia 9tdq1mt4XmmRdW8QkMTuAgLd2hjshRPpTedLFpqPz/qrFLZUiS7voL5GGE9o+OaY/Ndp Z1sXTwtNeVheIvagW6F5Biz6lRac+EPOLsVRofQyEFPxLB6pAkWE4HSnaWjY1ze82zkM K53g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=khaGAdaqkWaatpF0Kr1qGQR60qUuZJKnbxVAZoCcDPU=; b=Og99n9svDlSuA+0qFzNNCLK2dHDnpkB7xNCZnufRxp9sNmGI1Y0EDlYWk0la27MVgc GqOtFUdJ7VdCVyZNHEAHVbLVk0BamM9TTtbD3XUksljzOfKN8Mf6+Isnz3giEs1esbEZ a4nsZHaZ4naxzPeTl4Qr3GPnlTOdnEAV5iNqilOFyL05xn1YU4nV2AZsqlUtk64ShYrT LO+RseiDAQRg/u0CygnYvpL8O5HQzVRnU+3eeJnNyU/4ZsO25kW49AnYvGL4Xss3QtuE kFT/d9PFw8SEwKPxB6DfSmu7P23vn8gkWB8Kq8Rq9uiIj7aEodX8ogyuJEzKYr6bEjcO imNQ== X-Gm-Message-State: AOAM5335AESznsk5mXPMCvT0Dn/kpVm0M9U0sM3KhizT9qXYVtrQf1O4 eBbBfY01Bm5mxW6Ds8LiwRS1W2ZPA4eItQ== X-Google-Smtp-Source: ABdhPJw6kLJHmn1TdA4zfvfUkE+1oxnqMQo7ADYQwxA0Rv3XSpBohuYaL4IHQvymmc56O/CEn8AQBQ== X-Received: by 2002:a0c:ee43:: with SMTP id m3mr23941081qvs.34.1630339023818; Mon, 30 Aug 2021 08:57:03 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id 12sm8585217qtt.16.2021.08.30.08.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 08:57:03 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: steved@redhat.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v3 8/9] nfssysfs: Add a man page Date: Mon, 30 Aug 2021 11:56:52 -0400 Message-Id: <20210830155653.1386161-9-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> References: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker Signed-off-by: Anna Schumaker --- tools/nfssysfs/nfssysfs.man | 88 +++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 tools/nfssysfs/nfssysfs.man diff --git a/tools/nfssysfs/nfssysfs.man b/tools/nfssysfs/nfssysfs.man new file mode 100644 index 000000000000..7b00c1a81106 --- /dev/null +++ b/tools/nfssysfs/nfssysfs.man @@ -0,0 +1,88 @@ +.\" +.\" nfssysfs(8) +.\" +.TH nfssysfs 8 "05 Aug 2021" +.SH NAME +nfssysfs \- Displays NFS & SunRPC connection information +.SH SYNOPSIS +.B nfssysfs +.RB [ \-h | \-\-help ] +.P +.B nfssysfs rpc-client +.RB [ \-h | \-\-help ] +.RB [ \--id +.IR ID ] +.P +.B nfssysfs xprt-switch +.RB [ \-h | \-\-help ] +.RB [ \--id +.IR ID ] +.P +.B nfssysfs xprt-switch set +.RB [ \-h | \-\-help ] +.RB [ \--id +.IR ID ] +.RB [ \--dstaddr +.IR dstaddr] +.P +.B nfssysfs xprt +.RB [ \-h | \-\-help ] +.RB [ \--id +.IR ID ] +.P +.B nfssysfs xprt set +.RB [ \-h | \-\-help ] +.RB [ \--id +.IR ID ] +.RB [ \--dstaddr +.IR dstaddr] +.RB [ --offline ] +.RB [ --online ] +.RB [ --remove ] +.P +.SH DESCRIPTION +.RB "The " nfssysfs " command displays information collected in the SunRPC sysfs files about the system's SunRPC objects. +.P +.SS Objects +Valid +.BR nfssysfs (8) +objects are: +.IP "\fBrpc-client\fP" +Display information about this system's RPC clients. +.IP "\fBxprt-switch\fP" +Display information about groups of transports. +.IP "\fBxprt\fP" +Display detailed information about each transport that exists on the system. +.SH OPTIONS +.SS Options valid for all objects +.TP +.B \-h, \-\-help +Show the help message and exit +.TP +.B \-\-id \fIID +Set or display properties for the object with the given +.IR ID. +This option is mandatory for setting properties. +.SS Options specific to the `xprt-switch set` sub-command +.TP +.B \-\-dstaddr \fIdstaddr +Change the destination address of all transports in the xprt-switch to +.IR dstaddr +.SS Options specific to the `xprt set` sub-command +.TP +.B \-\-dstaddr \fIdstaddr +Change the destination address of this specific transport to +.TP +.B \-\-offline +Change the transport state from online to offline +.TP +.B \-\-online +Change the transport state from offline to online +.TP +.B \-\-remove +Removes the transport from the xprt-switch. Note that "main" transports cannot be removed. +.SH DIRECTORY +.TP +.B /sys/kernel/sunrpc/ +.SH AUTHOR +Anna Schumaker From patchwork Mon Aug 30 15:56:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12465499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03359C19F38 for ; Mon, 30 Aug 2021 15:57:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD4DD60F56 for ; Mon, 30 Aug 2021 15:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237526AbhH3P6G (ORCPT ); Mon, 30 Aug 2021 11:58:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237758AbhH3P6A (ORCPT ); Mon, 30 Aug 2021 11:58:00 -0400 Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3A92C0617AE for ; Mon, 30 Aug 2021 08:57:05 -0700 (PDT) Received: by mail-qv1-xf34.google.com with SMTP id e18so8586015qvo.1 for ; Mon, 30 Aug 2021 08:57:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SROUaiAMehrmiT3ELGDnLtiEyOT7RUgBLqWqJFw66F0=; b=P0N0s3UzPGci6qyOUjHT/NxZ5oKXk5IOYqJgPl/3aPSKP3QPxVLfJknh26b5lzQffy MRselXfM1Rw0Sbjmr28ou7FU6YUb9im1SiV9+Lj089MhzjJV84H3f2K5LRn/CS9ycfLg ZYtH6LoC3VZvBJKUMYieHLqIvu6hgUwURpNPCKWjbDbAwUL9bBLP6xNpK4o4REQE/dQU 5LuKT12tafZhNEdeujci7bND4b+rTX7enT5aqb3jKIj16Y455QXCvXBjPiC4g8cfaMap 14gv/ofW/0/Z+2aGnIej+/C6o+SiWQy+ujhFqRcKtsS+fEhJuhQljQ5O7A6YqmyZEPI5 uivA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=SROUaiAMehrmiT3ELGDnLtiEyOT7RUgBLqWqJFw66F0=; b=HPsc8p5Q93iLgSVXxNQTRXVwHjOuoGa0zOv3HPMYohvQgKBNP5OU5FvHLavrNR2Esq QsM+ECJsPiM0w7Ts6ywu23NH47QdO/BUmWlxVUp+iMF+0u9RbIT8wdgHhOoAdSy5h0Kv TvODoqxkpolYZwY/F3H4bbe7jxl13WvrE4zyyktlLASXR4f7Bxnt0Zvsr4bwy4rJiy5m PrDbIc7RmpP4G0DYHpU+psGwK1sBFNPZ8mKXDfL3i2rIinPw8O1HYlKQkzz8pcLvwbDt CKLaD8TjNp3pDrhWeQH9BFAaMqn9jmnY1w9mZL+IpNqvS4D70NevKQlC5Jh/DKrqb05q 6WzQ== X-Gm-Message-State: AOAM533zy7kLMILt2Qws0ixCCzlUaqYVgvVB9ATX0AOslwBqlPn7GYT3 xlgG88j15UOX8/n4bJtHXdE= X-Google-Smtp-Source: ABdhPJzJ4iweZFguGRDhWRf2q1JvfRHxIEH8nSzmq+2WHr52nAcqOELjAVWIO6IWVqbUFDA8NZuf7A== X-Received: by 2002:a0c:e790:: with SMTP id x16mr23587015qvn.6.1630339024736; Mon, 30 Aug 2021 08:57:04 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id 12sm8585217qtt.16.2021.08.30.08.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 08:57:04 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: steved@redhat.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v3 9/9] nfssysfs: Add installation to the Makefile Date: Mon, 30 Aug 2021 11:56:53 -0400 Message-Id: <20210830155653.1386161-10-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> References: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker And create a shell script that launches the python program from the $(libdir) Signed-off-by: Anna Schumaker --- configure.ac | 1 + tools/Makefile.am | 2 +- tools/nfssysfs/Makefile.am | 20 ++++++++++++++++++++ tools/nfssysfs/nfssysfs | 5 +++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tools/nfssysfs/Makefile.am create mode 100644 tools/nfssysfs/nfssysfs diff --git a/configure.ac b/configure.ac index bc2d0f02979c..57ad341948a3 100644 --- a/configure.ac +++ b/configure.ac @@ -731,6 +731,7 @@ AC_CONFIG_FILES([ tools/rpcgen/Makefile tools/mountstats/Makefile tools/nfs-iostat/Makefile + tools/nfssysfs/Makefile tools/nfsdclnts/Makefile tools/nfsconf/Makefile tools/nfsdclddb/Makefile diff --git a/tools/Makefile.am b/tools/Makefile.am index 9b4b0803db39..12c68b57b8ae 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -12,6 +12,6 @@ if CONFIG_NFSDCLD OPTDIRS += nfsdclddb endif -SUBDIRS = locktest rpcdebug nlmtest mountstats nfs-iostat nfsdclnts $(OPTDIRS) +SUBDIRS = locktest rpcdebug nlmtest mountstats nfs-iostat nfssysfs nfsdclnts $(OPTDIRS) MAINTAINERCLEANFILES = Makefile.in diff --git a/tools/nfssysfs/Makefile.am b/tools/nfssysfs/Makefile.am new file mode 100644 index 000000000000..983b128f5c98 --- /dev/null +++ b/tools/nfssysfs/Makefile.am @@ -0,0 +1,20 @@ +## Process this file with automake to produce Makefile.in +PYTHON_FILES = nfssysfs.py client.py switch.py sysfs.py xprt.py +tooldir = $(DESTDIR)$(libdir)/nfssysfs + +man8_MANS = nfssysfs.man + +all-local: $(PYTHON_FILES) + +install-data-hook: + mkdir -p $(tooldir) + for f in $(PYTHON_FILES) ; do \ + $(INSTALL) -m 644 $$f $(tooldir)/$$f ; \ + done + chmod +x $(tooldir)/nfssysfs.py + $(INSTALL) -m 755 nfssysfs $(DESTDIR)$(sbindir)/nfssysfs + sed -i "s|LIBDIR=.|LIBDIR=$(tooldir)|" $(DESTDIR)$(sbindir)/nfssysfs + + + +MAINTAINERCLEANFILES=Makefile.in diff --git a/tools/nfssysfs/nfssysfs b/tools/nfssysfs/nfssysfs new file mode 100644 index 000000000000..82dd2da6f539 --- /dev/null +++ b/tools/nfssysfs/nfssysfs @@ -0,0 +1,5 @@ +#!/bin/bash +LIBDIR=. +PYTHON3=/usr/bin/python + +exec $PYTHON3 $LIBDIR/nfssysfs.py $*