Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3714216pxb; Mon, 30 Aug 2021 08:58:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdIJ4xb/w1XtD0p7yosTsKAxae9vu7jN/jmlQab7/3pEhEGF6st3uc8AAiYeOW7iLpTypR X-Received: by 2002:a05:6402:22b3:: with SMTP id cx19mr17460167edb.238.1630339089335; Mon, 30 Aug 2021 08:58:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630339089; cv=none; d=google.com; s=arc-20160816; b=TQtrYN0avGn5lYteVKHGL6nuX8hH8ihPlArwxh04twAxKFpYMePt6VGl4U8SfwVJIE 7fSzNSIukpiask1TVQdMH9HmmRg18zwoLzJXMpcgl3ySUJHWPBBhTbYkqJl0c5IHDWq8 YSJB+p7sEPIc2R6kasFvJZvSaeFxP1vB+k/eJA/06Cio5iHSPRnYPqJFd7B11qroX+zn qwonYrYfbZJLGuS/4y4W4eifj0eKZ2rbeiwflOp0hYmM4LpzC88VuZm1vUrN37MEyr82 l5YPKM4nxgx1o1a6phwyhnIpqLxZLbsJ/gbg6QB+LNf7GuoX/wK3Ef7wre6lJGQ4SsJY nwWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=dk5BetLebNnEqSw14yGsvT2Uuhrbzwh3AKCWUAFJ8yk=; b=pHA7OGtCBd99WgozS60QnYoTJqleIeMUduVBHuX4L9nurxaWcj7FFw1hkrj5XdxsCk Mkjhzms8i8g25BtEiTvQRQVmsLWF8ytnpyg/ZRc2P69Z9Tne5p8Lp9pgYghYchkTijvK 6afx3bR7JEBjYOlLUKnTwglnpibzdbEAuvFB2brXqzIXynbUBcqiTjysrTnpUkyOfUnD sdCkSPJKD+ikTs+XHWUxYZukAUyJz4n2QW2w98234kP/z7vEdQI6E7xPRWZlxft1s/fI /C5ImmWvmM9saWLTD0l3NdCrnO8YZY6m5s+ESvAfuKmiATkQZznQerXce6Jd7FuDYKpN PVZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DtkvuRws; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k13si15670919ejp.411.2021.08.30.08.57.34; Mon, 30 Aug 2021 08:58:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DtkvuRws; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237813AbhH3P6A (ORCPT + 99 others); Mon, 30 Aug 2021 11:58:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237629AbhH3P5u (ORCPT ); Mon, 30 Aug 2021 11:57:50 -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 2482EC061575 for ; Mon, 30 Aug 2021 08:56:56 -0700 (PDT) Received: by mail-qv1-xf35.google.com with SMTP id g11so8581569qvd.2 for ; Mon, 30 Aug 2021 08:56:56 -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:mime-version :content-transfer-encoding; bh=dk5BetLebNnEqSw14yGsvT2Uuhrbzwh3AKCWUAFJ8yk=; b=DtkvuRwss0ixo5+g7SM2lo03SgvDSpU8Q34KWArIPl17O0tuDJ+HdRbpxvV5fC6t8V bgh1o1lL6ksOhYtiFCjS7LEy0AdK4koN0yEtZjt9hum9JRgC4M0L2i5cuze4m1U0jDMc uiThTZDu1/wQuAPKpscaFRiSir2/inEadb7JwyUVD3c5AudtUoAsSOu11yZSSKnv0L15 vsXNdSm/mSZaN36UFm5OymlBupMq2HFdRZBSggTj0FOHZPNCLjGht1lNnWk5g8tLG/l2 I5y5wu4l5T4eQuMHnIery/D4Ixoxwfu++Z6WegODOjwMcWzcv1WJ3GzgZqQq69It0Qw6 29cw== 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 :mime-version:content-transfer-encoding; bh=dk5BetLebNnEqSw14yGsvT2Uuhrbzwh3AKCWUAFJ8yk=; b=qJhvwdJRIVdyGt9EndLJbBa/sYxQnnnU5cODZ2ae5lkuJrE36m2DnmZu40xgxmOud9 GrtLVgL3sfUFKhlxFyfzJJD/qyivj0ZYkRItJG2ysQa/whY29CLz5JJGy27VNqIbzHGN WB0CF6JIQzltZgFgVWFofTI3ySRGhi/GoWcPIF6OP1B7HYgl0H4WE1dwmZxAHUMxH6pq +yIoH3gT1OgAHqj0R+R5boiSSxXtM70yQaEZVkFhWdAVVQ+6bs8eYwezt7vRYNDwn/Qd PPoVRMii0YnN7Em5T+Bxbkmz/g8ZkbZwbOUoDX9uNzYLnktqo85H1PgTFtE2P6xQRTVF 1l7w== X-Gm-Message-State: AOAM5301nv5kJazpecE0CGG4K6U0YOsbOtfeQbhXfTpNASvNWMgcL5+c T7gyxCYKuQwLC2fEsm0+EfU= X-Received: by 2002:a0c:e910:: with SMTP id a16mr24122169qvo.37.1630339015106; Mon, 30 Aug 2021 08:56:55 -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.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 08:56:54 -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 0/9] Add a tool for using the new sysfs files Date: Mon, 30 Aug 2021 11:56:44 -0400 Message-Id: <20210830155653.1386161-1-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker These patches implement a tool that can be used to read and write the sysfs files, with subcommands! They do need my extra patches to add in srcaddr and dst_port to the xprt_info file. Let me know if I need to resend adding support for kernels both with and without these patches. The following subcommands are implemented: nfssysfs.py rpc-client nfssysfs.py xprt nfssysfs.py xprt set nfssysfs.py xprt-switch nfssysfs.py xprt-switch set So you can print out information about every xprt-switch with: anna@client ~ % nfssysfs xprt-switch switch 0: num_xprts 1, num_active 1, queue_len 0 xprt 0: local, /var/run/gssproxy.sock [main] switch 1: num_xprts 1, num_active 1, queue_len 0 xprt 1: local, /var/run/rpcbind.sock [main] switch 2: num_xprts 1, num_active 1, queue_len 0 xprt 2: tcp, 192.168.111.1 [main] switch 3: num_xprts 4, num_active 4, queue_len 0 xprt 3: tcp, 192.168.111.188 [main] xprt 4: tcp, 192.168.111.188 xprt 5: tcp, 192.168.111.188 xprt 6: tcp, 192.168.111.188 And information about each xprt: anna@client ~ % nfssysfs xprt xprt 0: local, /var/run/gssproxy.sock, port 0, state Source: (einval), port 0, Requests: 2 Congestion: cur 0, win 256, Slots: min 2, max 65536 Queues: binding 0, sending 0, pending 0, backlog 0, tasks 0 xprt 1: local, /var/run/rpcbind.sock, port 0, state Source: (einval), port 0, Requests: 2 Congestion: cur 0, win 256, Slots: min 2, max 65536 Queues: binding 0, sending 0, pending 0, backlog 0, tasks 0 xprt 2: tcp, 192.168.111.1, port 2049, state Source: 192.168.111.222, port 959, Requests: 2 Congestion: cur 0, win 256, Slots: min 2, max 65536 Queues: binding 0, sending 0, pending 0, backlog 0, tasks 0 xprt 3: tcp, 192.168.111.188, port 2049, state Source: 192.168.111.222, port 921, Requests: 2 Congestion: cur 0, win 256, Slots: min 2, max 65536 Queues: binding 0, sending 0, pending 0, backlog 0, tasks 0 xprt 4: tcp, 192.168.111.188, port 2049, state Source: 192.168.111.222, port 726, Requests: 2 Congestion: cur 0, win 256, Slots: min 2, max 65536 Queues: binding 0, sending 0, pending 0, backlog 0, tasks 0 xprt 5: tcp, 192.168.111.188, port 2049, state Source: 192.168.111.222, port 671, Requests: 2 Congestion: cur 0, win 256, Slots: min 2, max 65536 Queues: binding 0, sending 0, pending 0, backlog 0, tasks 0 xprt 6: tcp, 192.168.111.188, port 2049, state Source: 192.168.111.222, port 934, Requests: 2 Congestion: cur 0, win 256, Slots: min 2, max 65536 Queues: binding 0, sending 0, pending 0, backlog 0, tasks 0 You can use the `set` subcommand to change the dstaddr of individual xprts: anna@client ~ % sudo nfssysfs xprt --id 4 xprt 4: tcp, 192.168.111.188, port 2049, state Source: 192.168.111.222, port 726, Requests: 2 Congestion: cur 0, win 256, Slots: min 2, max 65536 Queues: binding 0, sending 0, pending 0, backlog 0, tasks 0 anna@client ~ % sudo nfssysfs xprt set --id 4 --dstaddr server2.nowheycreamery.com xprt 4: tcp, 192.168.111.186, port 2049, state Source: 192.168.111.222, port 726, Requests: 2 Congestion: cur 0, win 256, Slots: min 2, max 65536 Queues: binding 0, sending 0, pending 0, backlog 0, tasks 0 Or for changing the dstaddr of all xprts attached to a switch: anna@client % ./nfssysfs.py xprt-switch --id 3 switch 3: num_xprts 4, num_active 4, queue_len 0 xprt 3: tcp, 192.168.111.188 [main] xprt 4: tcp, 192.168.111.188 xprt 5: tcp, 192.168.111.188 xprt 6: tcp, 192.168.111.188 anna@client % sudo ./nfssysfs.py xprt-switch set --id 4 --dstaddr server2.nowheycreamery.vm switch 3: num_xprts 4, num_active 4, queue_len 0 xprt 2: tcp, 192.168.111.186 [main] xprt 3: tcp, 192.168.111.186 xprt 5: tcp, 192.168.111.186 xprt 6: tcp, 192.168.111.186 One question I have is about the name right now. Is naming it "nfssysfs" okay, or would it be better to name it "nfs" with "sysfs" as a subcommand? Going with just "nfs" as the command name would allow us to add other non-sysfs tools as subcommands in the future (such as `nfs stat` to call `nfsstat`, or for new commands that would otherwise be prefixed with "nfs") Thoughts? Anna Anna Schumaker (9): nfssysfs: Add a nfssysfs.py tool nfssysfs.py: Add a command for printing xprt switch information nfssysfs.py: Add a command for printing individual xprts nfssysfs.py: Add a command for printing rpc-client information nfssysfs.py: Add a command for changing xprt dstaddr nfssysfs.py: Add a command for changing xprt-switch dstaddrs nfssysfs.py: Add a command for changing xprt state nfssysfs: Add a man page nfssysfs: Add installation to the Makefile .gitignore | 2 + configure.ac | 1 + tools/Makefile.am | 2 +- tools/nfssysfs/Makefile.am | 20 +++++++ tools/nfssysfs/client.py | 27 ++++++++++ tools/nfssysfs/nfssysfs | 5 ++ tools/nfssysfs/nfssysfs.man | 88 +++++++++++++++++++++++++++++++ tools/nfssysfs/nfssysfs.py | 23 ++++++++ tools/nfssysfs/switch.py | 51 ++++++++++++++++++ tools/nfssysfs/sysfs.py | 29 +++++++++++ tools/nfssysfs/xprt.py | 101 ++++++++++++++++++++++++++++++++++++ 11 files changed, 348 insertions(+), 1 deletion(-) create mode 100644 tools/nfssysfs/Makefile.am create mode 100644 tools/nfssysfs/client.py create mode 100644 tools/nfssysfs/nfssysfs create mode 100644 tools/nfssysfs/nfssysfs.man create mode 100755 tools/nfssysfs/nfssysfs.py create mode 100644 tools/nfssysfs/switch.py create mode 100644 tools/nfssysfs/sysfs.py create mode 100644 tools/nfssysfs/xprt.py -- 2.33.0