mbox series

[RFC,0/6] Add a tool for using the new sysfs files

Message ID 20210608174657.603256-1-Anna.Schumaker@Netapp.com (mailing list archive)
Headers show
Series Add a tool for using the new sysfs files | expand

Message

Anna Schumaker June 8, 2021, 5:46 p.m. UTC
From: Anna Schumaker <Anna.Schumaker@Netapp.com>

These patches implement a tool that can be used to read and write the
sysfs files, with subcommands! They need Olga's most recent patches to
run.

The following subcommands are implemented:
  nfs-sysfs.py rpc-client
  nfs-sysfs.py xprt
  nfs-sysfs.py xprt set
  nfs-sysfs.py xprt-switch
  nfs-sysfs.py xprt-switch set

So you can print out information about every xprt-switch with:
	anna@client % ./nfs-sysfs.py xprt-switch
	switch 0: num_xprts 1, num_active 1, queue_len 0
		xprt 0: local, /var/run/gssproxy.sock
	switch 1: num_xprts 1, num_active 1, queue_len 0
		xprt 1: local, /var/run/rpcbind.sock
	switch 2: num_xprts 4, num_active 4, queue_len 0
		xprt 2: tcp, 192.168.111.188
		xprt 3: tcp, 192.168.111.188
		xprt 5: tcp, 192.168.111.188
		xprt 6: tcp, 192.168.111.188
	switch 3: num_xprts 1, num_active 1, queue_len 0
		xprt 7: tcp, 192.168.111.1
	switch 4: num_xprts 1, num_active 1, queue_len 0
		xprt 4: tcp, 192.168.111.188

And information about each xprt:
	anna@client % ./nfs-sysfs.py xprt
	xprt 0: local, /var/run/gssproxy.sock, state <CONNECTED,BOUND>, num_reqs 2
		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
	xprt 1: local, /var/run/rpcbind.sock, state <CONNECTED,BOUND>, num_reqs 2
		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
	xprt 2: tcp, 192.168.111.188, state <CONNECTED,BOUND>, num_reqs 2
		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
	xprt 3: tcp, 192.168.111.188, state <CONNECTED,BOUND>, num_reqs 2
		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
	xprt 4: tcp, 192.168.111.188, state <BOUND>, num_reqs 2
		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
	xprt 5: tcp, 192.168.111.188, state <CONNECTED,BOUND>, num_reqs 2
		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
	xprt 6: tcp, 192.168.111.188, state <CONNECTED,BOUND>, num_reqs 2
		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
	xprt 7: tcp, 192.168.111.1, state <CONNECTED,BOUND>, num_reqs 2
		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0

You can use the `set` subcommand to change the dstaddr of individual xprts:
	anna@client % ./nfs-sysfs.py xprt --id 2
	xprt 2: tcp, 192.168.111.188, state <CONNECTED,BOUND>, num_reqs 2
		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
	anna@client % sudo ./nfs-sysfs.py xprt set --id 2 --dstaddr server2.nowheycreamery.vm
	xprt 2: tcp, 192.168.111.186, state <CONNECTED,BOUND>, num_reqs 2
		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0

Or for changing the dstaddr of all xprts attached to a switch:
	anna@client % ./nfs-sysfs.py xprt-switch --id 2
	switch 2: num_xprts 4, num_active 4, queue_len 0
		xprt 2: tcp, 192.168.111.188
		xprt 3: tcp, 192.168.111.188
		xprt 5: tcp, 192.168.111.188
		xprt 6: tcp, 192.168.111.188
	anna@client % sudo ./nfs-sysfs.py xprt-switch set --id 2 --dstaddr server2.nowheycreamery.vm
	switch 2: num_xprts 4, num_active 4, queue_len 0
		xprt 2: tcp, 192.168.111.186
		xprt 3: tcp, 192.168.111.186
		xprt 5: tcp, 192.168.111.186
		xprt 6: tcp, 192.168.111.186


I'm sure this needs lots of polish before it's ready for inclusion,
along with needing a Makefile so it can be installed (I've just been
running it out of the nfs-utils/tools/nfs-sysfs/ directory). But it's
still a start, and I wanted to post it before going on New Baby Leave
Part 2 (June 12 - July 11).

What does everybody think?
Anna


Anna Schumaker (6):
  nfs-sysfs: Add an nfs-sysfs.py tool
  nfs-sysfs.py: Add a command for printing xprt switch information
  nfs-sysfs.py: Add a command for printing individual xprts
  nfs-sysfs.py: Add a command for printing rpc-client information
  nfs-sysfs.py: Add a command for changing xprt dstaddr
  nfs-sysfs.py: Add a command for changing xprt-switch dstaddrs

 tools/nfs-sysfs/client.py    | 27 ++++++++++++++
 tools/nfs-sysfs/nfs-sysfs.py | 23 ++++++++++++
 tools/nfs-sysfs/switch.py    | 51 +++++++++++++++++++++++++++
 tools/nfs-sysfs/sysfs.py     | 28 +++++++++++++++
 tools/nfs-sysfs/xprt.py      | 68 ++++++++++++++++++++++++++++++++++++
 5 files changed, 197 insertions(+)
 create mode 100644 tools/nfs-sysfs/client.py
 create mode 100755 tools/nfs-sysfs/nfs-sysfs.py
 create mode 100644 tools/nfs-sysfs/switch.py
 create mode 100644 tools/nfs-sysfs/sysfs.py
 create mode 100644 tools/nfs-sysfs/xprt.py

Comments

Steve Dickson June 14, 2021, 1:19 p.m. UTC | #1
On 6/8/21 1:46 PM, schumaker.anna@gmail.com wrote:
> From: Anna Schumaker <Anna.Schumaker@Netapp.com>
> 
> These patches implement a tool that can be used to read and write the
> sysfs files, with subcommands! They need Olga's most recent patches to
> run.
> 
> The following subcommands are implemented:
>    nfs-sysfs.py rpc-client
>    nfs-sysfs.py xprt
>    nfs-sysfs.py xprt set
>    nfs-sysfs.py xprt-switch
>    nfs-sysfs.py xprt-switch set
> 
> So you can print out information about every xprt-switch with:
> 	anna@client % ./nfs-sysfs.py xprt-switch
> 	switch 0: num_xprts 1, num_active 1, queue_len 0
> 		xprt 0: local, /var/run/gssproxy.sock
> 	switch 1: num_xprts 1, num_active 1, queue_len 0
> 		xprt 1: local, /var/run/rpcbind.sock
> 	switch 2: num_xprts 4, num_active 4, queue_len 0
> 		xprt 2: tcp, 192.168.111.188
> 		xprt 3: tcp, 192.168.111.188
> 		xprt 5: tcp, 192.168.111.188
> 		xprt 6: tcp, 192.168.111.188
> 	switch 3: num_xprts 1, num_active 1, queue_len 0
> 		xprt 7: tcp, 192.168.111.1
> 	switch 4: num_xprts 1, num_active 1, queue_len 0
> 		xprt 4: tcp, 192.168.111.188
> 
> And information about each xprt:
> 	anna@client % ./nfs-sysfs.py xprt
> 	xprt 0: local, /var/run/gssproxy.sock, state <CONNECTED,BOUND>, num_reqs 2
> 		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> 		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> 	xprt 1: local, /var/run/rpcbind.sock, state <CONNECTED,BOUND>, num_reqs 2
> 		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> 		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> 	xprt 2: tcp, 192.168.111.188, state <CONNECTED,BOUND>, num_reqs 2
> 		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> 		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> 	xprt 3: tcp, 192.168.111.188, state <CONNECTED,BOUND>, num_reqs 2
> 		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> 		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> 	xprt 4: tcp, 192.168.111.188, state <BOUND>, num_reqs 2
> 		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> 		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> 	xprt 5: tcp, 192.168.111.188, state <CONNECTED,BOUND>, num_reqs 2
> 		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> 		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> 	xprt 6: tcp, 192.168.111.188, state <CONNECTED,BOUND>, num_reqs 2
> 		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> 		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> 	xprt 7: tcp, 192.168.111.1, state <CONNECTED,BOUND>, num_reqs 2
> 		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> 		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> 
> You can use the `set` subcommand to change the dstaddr of individual xprts:
> 	anna@client % ./nfs-sysfs.py xprt --id 2
> 	xprt 2: tcp, 192.168.111.188, state <CONNECTED,BOUND>, num_reqs 2
> 		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> 		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> 	anna@client % sudo ./nfs-sysfs.py xprt set --id 2 --dstaddr server2.nowheycreamery.vm
> 	xprt 2: tcp, 192.168.111.186, state <CONNECTED,BOUND>, num_reqs 2
> 		cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> 		binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> 
> Or for changing the dstaddr of all xprts attached to a switch:
> 	anna@client % ./nfs-sysfs.py xprt-switch --id 2
> 	switch 2: num_xprts 4, num_active 4, queue_len 0
> 		xprt 2: tcp, 192.168.111.188
> 		xprt 3: tcp, 192.168.111.188
> 		xprt 5: tcp, 192.168.111.188
> 		xprt 6: tcp, 192.168.111.188
> 	anna@client % sudo ./nfs-sysfs.py xprt-switch set --id 2 --dstaddr server2.nowheycreamery.vm
> 	switch 2: num_xprts 4, num_active 4, queue_len 0
> 		xprt 2: tcp, 192.168.111.186
> 		xprt 3: tcp, 192.168.111.186
> 		xprt 5: tcp, 192.168.111.186
> 		xprt 6: tcp, 192.168.111.186
> 
> 
> I'm sure this needs lots of polish before it's ready for inclusion,
> along with needing a Makefile so it can be installed (I've just been
> running it out of the nfs-utils/tools/nfs-sysfs/ directory). But it's
> still a start, and I wanted to post it before going on New Baby Leave
> Part 2 (June 12 - July 11).
> 
> What does everybody think?
The first thing that popped in my was is where is the man page,
but this being a developers tool, maybe one is not needed?? (ala pynfs).
Although if its going to be installed from nfs-utils, it would
be nice to have a man page.

The second thing was I was thinking... it would be good if
we could run this command on a kernel dump... to see what was
going on when things crashed...

Nice work!

steved.

> Anna
> 
> 
> Anna Schumaker (6):
>    nfs-sysfs: Add an nfs-sysfs.py tool
>    nfs-sysfs.py: Add a command for printing xprt switch information
>    nfs-sysfs.py: Add a command for printing individual xprts
>    nfs-sysfs.py: Add a command for printing rpc-client information
>    nfs-sysfs.py: Add a command for changing xprt dstaddr
>    nfs-sysfs.py: Add a command for changing xprt-switch dstaddrs
> 
>   tools/nfs-sysfs/client.py    | 27 ++++++++++++++
>   tools/nfs-sysfs/nfs-sysfs.py | 23 ++++++++++++
>   tools/nfs-sysfs/switch.py    | 51 +++++++++++++++++++++++++++
>   tools/nfs-sysfs/sysfs.py     | 28 +++++++++++++++
>   tools/nfs-sysfs/xprt.py      | 68 ++++++++++++++++++++++++++++++++++++
>   5 files changed, 197 insertions(+)
>   create mode 100644 tools/nfs-sysfs/client.py
>   create mode 100755 tools/nfs-sysfs/nfs-sysfs.py
>   create mode 100644 tools/nfs-sysfs/switch.py
>   create mode 100644 tools/nfs-sysfs/sysfs.py
>   create mode 100644 tools/nfs-sysfs/xprt.py
>
Anna Schumaker June 14, 2021, 1:42 p.m. UTC | #2
Hi Steve,

On Mon, Jun 14, 2021 at 9:16 AM Steve Dickson <steved@redhat.com> wrote:
>
>
>
> On 6/8/21 1:46 PM, schumaker.anna@gmail.com wrote:
> > From: Anna Schumaker <Anna.Schumaker@Netapp.com>
> >
> > These patches implement a tool that can be used to read and write the
> > sysfs files, with subcommands! They need Olga's most recent patches to
> > run.
> >
> > The following subcommands are implemented:
> >    nfs-sysfs.py rpc-client
> >    nfs-sysfs.py xprt
> >    nfs-sysfs.py xprt set
> >    nfs-sysfs.py xprt-switch
> >    nfs-sysfs.py xprt-switch set
> >
> > So you can print out information about every xprt-switch with:
> >       anna@client % ./nfs-sysfs.py xprt-switch
> >       switch 0: num_xprts 1, num_active 1, queue_len 0
> >               xprt 0: local, /var/run/gssproxy.sock
> >       switch 1: num_xprts 1, num_active 1, queue_len 0
> >               xprt 1: local, /var/run/rpcbind.sock
> >       switch 2: num_xprts 4, num_active 4, queue_len 0
> >               xprt 2: tcp, 192.168.111.188
> >               xprt 3: tcp, 192.168.111.188
> >               xprt 5: tcp, 192.168.111.188
> >               xprt 6: tcp, 192.168.111.188
> >       switch 3: num_xprts 1, num_active 1, queue_len 0
> >               xprt 7: tcp, 192.168.111.1
> >       switch 4: num_xprts 1, num_active 1, queue_len 0
> >               xprt 4: tcp, 192.168.111.188
> >
> > And information about each xprt:
> >       anna@client % ./nfs-sysfs.py xprt
> >       xprt 0: local, /var/run/gssproxy.sock, state <CONNECTED,BOUND>, num_reqs 2
> >               cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> >               binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> >       xprt 1: local, /var/run/rpcbind.sock, state <CONNECTED,BOUND>, num_reqs 2
> >               cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> >               binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> >       xprt 2: tcp, 192.168.111.188, state <CONNECTED,BOUND>, num_reqs 2
> >               cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> >               binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> >       xprt 3: tcp, 192.168.111.188, state <CONNECTED,BOUND>, num_reqs 2
> >               cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> >               binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> >       xprt 4: tcp, 192.168.111.188, state <BOUND>, num_reqs 2
> >               cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> >               binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> >       xprt 5: tcp, 192.168.111.188, state <CONNECTED,BOUND>, num_reqs 2
> >               cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> >               binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> >       xprt 6: tcp, 192.168.111.188, state <CONNECTED,BOUND>, num_reqs 2
> >               cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> >               binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> >       xprt 7: tcp, 192.168.111.1, state <CONNECTED,BOUND>, num_reqs 2
> >               cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> >               binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> >
> > You can use the `set` subcommand to change the dstaddr of individual xprts:
> >       anna@client % ./nfs-sysfs.py xprt --id 2
> >       xprt 2: tcp, 192.168.111.188, state <CONNECTED,BOUND>, num_reqs 2
> >               cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> >               binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> >       anna@client % sudo ./nfs-sysfs.py xprt set --id 2 --dstaddr server2.nowheycreamery.vm
> >       xprt 2: tcp, 192.168.111.186, state <CONNECTED,BOUND>, num_reqs 2
> >               cur_cong 0, cong_win 256, min_num_slots 2, max_num_slots 65536
> >               binding_q_len 0, sending_q_len 0, pending_q_len 0, backlog_q_len 0
> >
> > Or for changing the dstaddr of all xprts attached to a switch:
> >       anna@client % ./nfs-sysfs.py xprt-switch --id 2
> >       switch 2: num_xprts 4, num_active 4, queue_len 0
> >               xprt 2: tcp, 192.168.111.188
> >               xprt 3: tcp, 192.168.111.188
> >               xprt 5: tcp, 192.168.111.188
> >               xprt 6: tcp, 192.168.111.188
> >       anna@client % sudo ./nfs-sysfs.py xprt-switch set --id 2 --dstaddr server2.nowheycreamery.vm
> >       switch 2: num_xprts 4, num_active 4, queue_len 0
> >               xprt 2: tcp, 192.168.111.186
> >               xprt 3: tcp, 192.168.111.186
> >               xprt 5: tcp, 192.168.111.186
> >               xprt 6: tcp, 192.168.111.186
> >
> >
> > I'm sure this needs lots of polish before it's ready for inclusion,
> > along with needing a Makefile so it can be installed (I've just been
> > running it out of the nfs-utils/tools/nfs-sysfs/ directory). But it's
> > still a start, and I wanted to post it before going on New Baby Leave
> > Part 2 (June 12 - July 11).
> >
> > What does everybody think?
> The first thing that popped in my was is where is the man page,
> but this being a developers tool, maybe one is not needed?? (ala pynfs).
> Although if its going to be installed from nfs-utils, it would
> be nice to have a man page.

Yeah, I was expecting to write a man page at some point before a
non-RFC submission, since commands and options might change after
hearing feedback from everyone.
>
> The second thing was I was thinking... it would be good if
> we could run this command on a kernel dump... to see what was
> going on when things crashed...

That would be useful, but I'm having trouble conceptualizing how that
would work since the contents of each file are generated by the kernel
when the files are read. If there is a way to do it, then the tool
could definitely be expanded to add it in!

>
> Nice work!

Thanks!
Anna
>
> steved.
>
> > Anna
> >
> >
> > Anna Schumaker (6):
> >    nfs-sysfs: Add an nfs-sysfs.py tool
> >    nfs-sysfs.py: Add a command for printing xprt switch information
> >    nfs-sysfs.py: Add a command for printing individual xprts
> >    nfs-sysfs.py: Add a command for printing rpc-client information
> >    nfs-sysfs.py: Add a command for changing xprt dstaddr
> >    nfs-sysfs.py: Add a command for changing xprt-switch dstaddrs
> >
> >   tools/nfs-sysfs/client.py    | 27 ++++++++++++++
> >   tools/nfs-sysfs/nfs-sysfs.py | 23 ++++++++++++
> >   tools/nfs-sysfs/switch.py    | 51 +++++++++++++++++++++++++++
> >   tools/nfs-sysfs/sysfs.py     | 28 +++++++++++++++
> >   tools/nfs-sysfs/xprt.py      | 68 ++++++++++++++++++++++++++++++++++++
> >   5 files changed, 197 insertions(+)
> >   create mode 100644 tools/nfs-sysfs/client.py
> >   create mode 100755 tools/nfs-sysfs/nfs-sysfs.py
> >   create mode 100644 tools/nfs-sysfs/switch.py
> >   create mode 100644 tools/nfs-sysfs/sysfs.py
> >   create mode 100644 tools/nfs-sysfs/xprt.py
> >
>