Processing nbd device details (nbdshow)

The nbdshow program allows users to view the detailed information about Network Block Devices (nbd):

Options provided by ‘nbdshow’:

crash> nbdshow -h
usage: nbdshow [-h] [-d] [-v] [--check]

optional arguments:
  -h, --help     show this help message and exit
  -d, --devices  show nbd devices
  -v, --verbose  verbose output
  --check        check for common nbd device, connection issues

 ** Execution took   0.01s (real)   0.01s (CPU)
crash>

Show nbd devices (-d)

The '-d' option prints basic information about nbd devices:

crash> nbdshow -d

===========================================================================================================================
INDEX     DEV NAME        nbd_device           nbd_config             gendisk              timeout    flags    nr_hw_queues
---------------------------------------------------------------------------------------------------------------------------
    0     nbd0            ffffa02e96422a00     ffffa0318952ab80       ffffa02e4cc13000   3600.000s      0x2               3
    1     nbd1            ffffa02e96423200     ffffa0318952a080       ffffa02e674fd000   3600.000s      0x2               3
    2     nbd2            ffffa02e97726a00     ffffa0318952ae00       ffffa02e674fb000   3600.000s      0x2               3
    3     nbd3            ffffa02e977fd200     ffffa0318952a480       ffffa02e4cd0b000   3600.000s      0x2               3
    4     nbd4            ffffa02e977fce00     ffffa033856b1e00       ffffa02e5a4ee800   3600.000s      0x2               3
    5     nbd5            ffffa02e97761e00     ffffa033856b1b00       ffffa02e5a4e9000   3600.000s      0x2               3
    6     nbd6            ffffa02ea27cde00                    0       ffffa02e59d1b800      0.000s      0x2               3
    7     nbd7            ffffa02e96431000                    0       ffffa02e72b40000      0.000s      0x2               3
    8     nbd8            ffffa02ea44dfe00                    0       ffffa02e4cc70800      0.000s      0x2               3
    9     nbd9            ffffa02ea4662e00                    0       ffffa02e4cc77800      0.000s      0x2               3
   10     nbd10           ffffa02e97783000                    0       ffffa02e4cce2800      0.000s      0x2               3
   11     nbd11           ffffa02ea4bddc00                    0       ffffa02e4cce3800      0.000s      0x2               3
   12     nbd12           ffffa02e8ee59000                    0       ffffa02e4cc9b800      0.000s      0x2               3
[...]

It also supports '-v' option which prints more verbose information about each nbd devices:

crash> nbdshow -d -v |head -100

===========================================================================================================================
INDEX     DEV NAME        nbd_device           nbd_config             gendisk              timeout    flags    nr_hw_queues
---------------------------------------------------------------------------------------------------------------------------
    0     nbd0            ffffa02e96422a00     ffffa0318952ab80       ffffa02e4cc13000   3600.000s      0x2               3

   nbd device details
   ------------------
   nr_maps              : 1
   nr_hw_queues         : 3
   queue_depth          : 128
   reserved_tags        : 0
   cmd_size             : 72
   numa_node            : -1
   pid                  : 2382996    (pid of nbd-client, if attached)

   nbd config details
   ------------------
   nbd_config           : ffffa0318952ab80
   runtime_flags        : 0xb8
   dead_conn_timeout    : 0
   num_connections      : 3
   live_connections     : 3
   recv_threads         : 3
   blksize              : 512
   bytesize             : 85899345920

   nbd socket details
   ------------------
   Socket No.           : 0
   nbd_sock             : ffffa02fc7047a00
   nbd_sock.dead        : false
   socket               : ffffa02eb4fbb700
   socket.sk            : ffffa02f09061680
   state                : SS_CONNECTED

   Socket No.           : 1
   nbd_sock             : ffffa02fc70470c0
   nbd_sock.dead        : false
   socket               : ffffa02eb4fbbc80
   socket.sk            : ffffa02f09063a80
   state                : SS_CONNECTED

   Socket No.           : 2
   nbd_sock             : ffffa02fc7047980
   nbd_sock.dead        : false
   socket               : ffffa02eb4fb8000
   socket.sk            : ffffa02f09060480
   state                : SS_CONNECTED

===========================================================================================================================
INDEX     DEV NAME        nbd_device           nbd_config             gendisk              timeout    flags    nr_hw_queues
---------------------------------------------------------------------------------------------------------------------------
    1     nbd1            ffffa02e96423200     ffffa0318952a080       ffffa02e674fd000   3600.000s      0x2               3

   nbd device details
   ------------------
   nr_maps              : 1
   nr_hw_queues         : 3
   queue_depth          : 128
   reserved_tags        : 0
   cmd_size             : 72
   numa_node            : -1
   pid                  : 2382996    (pid of nbd-client, if attached)

   nbd config details
   ------------------
   nbd_config           : ffffa0318952a080
   runtime_flags        : 0xae
   dead_conn_timeout    : 0
   num_connections      : 3
   live_connections     : 0
   recv_threads         : 0
   blksize              : 512
   bytesize             : 128849018880

   nbd socket details
   ------------------
   Socket No.           : 0
   nbd_sock             : ffffa02fc7047ac0
   nbd_sock.dead        : true
   socket               : ffffa02eb4fbb9c0
   socket.sk            : ffffa02e7c3ae780
   state                : SS_CONNECTED
[...]

Check for common nbd device, connection issues (--check)

The '--check' option runs a couple of checks to identify common problems with nbd devices that could affect the IO operations. For example, it checks for number of connections used to connect to nbd devices, how many of those connections are currently live/active, if any sockets used by those connections are in dead state, etc.:

crash> nbdshow --check
ERROR:   nbd_device: ffffa02e96423200 (nbd1), socket: ffffa02fc7047ac0, (socket no: 0) is dead
ERROR:   nbd_device: ffffa02e96423200 (nbd1), socket: ffffa02fc7047ec0, (socket no: 1) is dead
ERROR:   nbd_device: ffffa02e96423200 (nbd1), socket: ffffa02fc7047200, (socket no: 2) is dead
ERROR:   nbd_device: ffffa02ea27cde00 (nbd6) has invalid client pid: 0
ERROR:   nbd_device: ffffa02ea27cde00 (nbd6) has NULL nbd_config pointer
ERROR:   nbd_device: ffffa02e96431000 (nbd7) has invalid client pid: 0
ERROR:   nbd_device: ffffa02e96431000 (nbd7) has NULL nbd_config pointer
ERROR:   nbd_device: ffffa02ea44dfe00 (nbd8) has invalid client pid: 0
ERROR:   nbd_device: ffffa02ea44dfe00 (nbd8) has NULL nbd_config pointer
ERROR:   nbd_device: ffffa02ea4662e00 (nbd9) has invalid client pid: 0
ERROR:   nbd_device: ffffa02ea4662e00 (nbd9) has NULL nbd_config pointer
ERROR:   nbd_device: ffffa02e97783000 (nbd10) has invalid client pid: 0
ERROR:   nbd_device: ffffa02e97783000 (nbd10) has NULL nbd_config pointer
ERROR:   nbd_device: ffffa02ea4bddc00 (nbd11) has invalid client pid: 0
ERROR:   nbd_device: ffffa02ea4bddc00 (nbd11) has NULL nbd_config pointer
[...]
ERROR:   nbd_device: ffffa0338c683c00 (nbd122) has invalid client pid: 0
ERROR:   nbd_device: ffffa0338c683c00 (nbd122) has NULL nbd_config pointer
ERROR:   nbd_device: ffffa031fa387e00 (nbd123) has invalid client pid: 0
ERROR:   nbd_device: ffffa031fa387e00 (nbd123) has NULL nbd_config pointer
ERROR:   nbd_device: ffffa033a8878c00 (nbd124) has invalid client pid: 0
ERROR:   nbd_device: ffffa033a8878c00 (nbd124) has NULL nbd_config pointer


Errors: 241


 ** Execution took   0.02s (real)   0.02s (CPU)
crash>