Giter Club home page Giter Club logo

sasutils's Introduction

sasutils is a set of command-line tools and a Python library to ease the administration of Serial Attached SCSI (SAS) storage networks.

image

Supported Python Versions

License

sasutils command-line tools

  • sas_counters
  • sas_devices
  • sas_discover
  • ses_report

Also, a few "zeroconf" udev scripts for use in udev rules that create friendly device aliases using SES-2 subenclosure nicknames.

  • sas_mpath_snic_alias
  • sas_sd_snic_alias
  • sas_st_snic_alias

Note

While sasutils gets most of the system data from sysfs (/sys), sg_ses (available in sg3_utils or sg3-utils) and smp_discover (available in smp_utils or smp-utils) are required for some SES features to work.

sas_counters

sas_counters reports SAS/SES/SD I/O and phy error counters and provides SAS topology information in an output suitable for Carbon/Graphite. This command also supports SES-2 nicknames as seen in the example below (io1-sassw1 is the nickname of a SAS switch and io1-jbod1-0 is the nickname of a JBOD SIM).

$ sas_counters
...
oak-io1-s1.SAS9300-8e.0x500605b00ab01234.Switch184.io1-sassw1.JB4602_SIM_0.io1-jbod1-0.bays.41.ST8000NM0075.0x5000c50084c79876.ioerr_cnt 2 1487457378
oak-io1-s1.SAS9300-8e.0x500605b00ab01234.Switch184.io1-sassw1.JB4602_SIM_0.io1-jbod1-0.bays.41.ST8000NM0075.0x5000c50084c79876.iodone_cnt 7154904 1487457378
oak-io1-s1.SAS9300-8e.0x500605b00ab01234.Switch184.io1-sassw1.JB4602_SIM_0.io1-jbod1-0.bays.41.ST8000NM0075.0x5000c50084c79876.iorequest_cnt 7154906 1487457378
...
oak-io1-s1.SAS9300-8e.0x500605b00ab05678.Switch184.io1-sassw2.phys.15.invalid_dword_count 5 1487457378
oak-io1-s1.SAS9300-8e.0x500605b00ab05678.Switch184.io1-sassw2.phys.15.loss_of_dword_sync_count 1 1487457378
oak-io1-s1.SAS9300-8e.0x500605b00ab05678.Switch184.io1-sassw2.phys.15.phy_reset_problem_count 0 1487457378
oak-io1-s1.SAS9300-8e.0x500605b00ab05678.Switch184.io1-sassw2.phys.15.running_disparity_error_count 1 1487457378
...

sas_discover

Display SAS topology. By default, sas_discover tries to fold common devices (like disks). Use -v, -vv or -vvv and --addr to display more details. Below is an example with a large topology with multiple SAS HBAs, SAS switches and SAS JBODs.

$ sas_discover -v
oak-io8-s2
|--host1 HBA 9500-16e
|  `--8x--expander-1:0 ASTEK 
|         |--1x--end_device-1:0:0
|         |      `--enclosure io8-sassw2 ASTEK 
|         |--4x--expander-1:1 HGST 
|         |      |--1x--end_device-1:1:0
|         |      |      `--enclosure io8-jbod1 HGST 
|         |      |--10x--expander-1:9 HGST 
|         |      |  `-- 50 x end_device -- disk
|         |      `--10x--expander-1:10 HGST 
|         |         `-- 51 x end_device -- disk
|         |--4x--expander-1:2 HGST 
|         |      |--1x--end_device-1:2:0
|         |      |      `--enclosure io8-jbod2 HGST 
|         |      |--10x--expander-1:11 HGST 
|         |      |  `-- 51 x end_device -- disk
|         |      `--10x--expander-1:12 HGST 
|         |         `-- 51 x end_device -- disk
|         |--4x--expander-1:3 HGST 
|         |      |--1x--end_device-1:3:0
|         |      |      `--enclosure io8-jbod3 HGST 
|         |      |--10x--expander-1:13 HGST 
|         |      |  `-- 51 x end_device -- disk
|         |      `--10x--expander-1:14 HGST 
|         |         `-- 51 x end_device -- disk
|         |--4x--expander-1:4 HGST 
|         |      |--1x--end_device-1:4:0
|         |      |      `--enclosure io8-jbod4 HGST 
|         |      |--10x--expander-1:15 HGST 
|         |      |  `-- 51 x end_device -- disk
|         |      `--10x--expander-1:16 HGST 
|         |         `-- 51 x end_device -- disk
|         |--4x--expander-1:5 HGST 
|         |      |--1x--end_device-1:5:0
|         |      |      `--enclosure io8-jbod5 HGST 
|         |      |--10x--expander-1:17 HGST 
|         |      |  `-- 51 x end_device -- disk
|         |      `--10x--expander-1:18 HGST 
|         |         `-- 51 x end_device -- disk
|         |--4x--expander-1:6 HGST 
|         |      |--1x--end_device-1:6:0
|         |      |      `--enclosure io8-jbod6 HGST 
|         |      |--10x--expander-1:19 HGST 
|         |      |  `-- 51 x end_device -- disk
|         |      `--10x--expander-1:20 HGST 
|         |         `-- 51 x end_device -- disk
|         |--4x--expander-1:7 HGST 
|         |      |--1x--end_device-1:7:0
|         |      |      `--enclosure io8-jbod7 HGST 
|         |      |--10x--expander-1:21 HGST 
|         |      |  `-- 51 x end_device -- disk
|         |      `--10x--expander-1:22 HGST 
|         |         `-- 51 x end_device -- disk
|         `--4x--expander-1:8 HGST 
|                |--1x--end_device-1:8:0
|                |      `--enclosure io8-jbod8 HGST 
|                |--10x--expander-1:23 HGST 
|                |  `-- 51 x end_device -- disk
|                `--10x--expander-1:24 HGST 
|                   `-- 51 x end_device -- disk
`--host10 HBA 9500-16e
   `--8x--expander-10:0 ASTEK 
          |--1x--end_device-10:0:0
          |      `--enclosure io8-sassw1 ASTEK 
          |--4x--expander-10:1 HGST 
          |      |--1x--end_device-10:1:0
          |      |      `--enclosure io8-jbod1 HGST 
          |      |--10x--expander-10:9 HGST 
          |      |  `-- 50 x end_device -- disk
          |      `--10x--expander-10:10 HGST 
          |         `-- 51 x end_device -- disk
          |--4x--expander-10:2 HGST 
          |      |--1x--end_device-10:2:0
          |      |      `--enclosure io8-jbod2 HGST 
          |      |--10x--expander-10:11 HGST 
          |      |  `-- 51 x end_device -- disk
          |      `--10x--expander-10:12 HGST 
          |         `-- 51 x end_device -- disk
          |--4x--expander-10:3 HGST 
          |      |--1x--end_device-10:3:0
          |      |      `--enclosure io8-jbod3 HGST 
          |      |--10x--expander-10:13 HGST 
          |      |  `-- 51 x end_device -- disk
          |      `--10x--expander-10:14 HGST 
          |         `-- 51 x end_device -- disk
          |--4x--expander-10:4 HGST 
          |      |--1x--end_device-10:4:0
          |      |      `--enclosure io8-jbod4 HGST 
          |      |--10x--expander-10:15 HGST 
          |      |  `-- 51 x end_device -- disk
          |      `--10x--expander-10:16 HGST 
          |         `-- 51 x end_device -- disk
          |--4x--expander-10:5 HGST 
          |      |--1x--end_device-10:5:0
          |      |      `--enclosure io8-jbod5 HGST 
          |      |--10x--expander-10:17 HGST 
          |      |  `-- 51 x end_device -- disk
          |      `--10x--expander-10:18 HGST 
          |         `-- 51 x end_device -- disk
          |--4x--expander-10:6 HGST 
          |      |--1x--end_device-10:6:0
          |      |      `--enclosure io8-jbod6 HGST 
          |      |--10x--expander-10:19 HGST 
          |      |  `-- 51 x end_device -- disk
          |      `--10x--expander-10:20 HGST 
          |         `-- 51 x end_device -- disk
          |--4x--expander-10:7 HGST 
          |      |--1x--end_device-10:7:0
          |      |      `--enclosure io8-jbod7 HGST 
          |      |--10x--expander-10:21 HGST 
          |      |  `-- 51 x end_device -- disk
          |      `--10x--expander-10:22 HGST 
          |         `-- 51 x end_device -- disk
          `--4x--expander-10:8 HGST 
                 |--1x--end_device-10:8:0
                 |      `--enclosure io8-jbod8 HGST 
                 |--10x--expander-10:23 HGST 
                 |  `-- 51 x end_device -- disk
                 `--10x--expander-10:24 HGST 
                    `-- 51 x end_device -- disk

Use sas_discover --counters to display the number of SCSI commands issued (req), completed or rejected (done) and the ones that completed with an error (error).

image

sas_devices

Zeroconf tool that scans SAS devices and resolves associated enclosures. Useful to quickly check cabling and hardware setup.

When used with -v, sas_devices will also display all disk devices with serial numbers.

The following example shows a proper detection of a 60-disk JBOD with 2 SIMs/IOMs (an "enclosure group").

$ sas_devices
Found 2 SAS hosts
Found 4 SAS expanders
Found 1 enclosure groups
Enclosure group: [io1-jbod1-0][io1-jbod1-1]
NUM         VENDOR            MODEL    REV     SIZE  PATHS
 60 x      SEAGATE     ST8000NM0075   E004    8.0TB      2
Total: 60 block devices in enclosure group

The following example shows a proper detection of four Seagate Exos E JBOFs with 15.4TB SSDs. Note that 2 IOMs are detected for each JBOF and they have the same SES-2 nickname (this is normal with this hardware).

$ sas_devices
Found 2 SAS hosts
Found 8 SAS expanders
Found 4 enclosure groups
Enclosure group: [io1-jbof4][io1-jbof4]
NUM         VENDOR            MODEL    REV     SIZE  PATHS
 24 x      SEAGATE   XS15360SE70084   0003   15.4TB      2
Total: 24 block devices in enclosure group
Enclosure group: [io1-jbof2][io1-jbof2]
NUM         VENDOR            MODEL    REV     SIZE  PATHS
 24 x      SEAGATE   XS15360SE70084   0003   15.4TB      2
Total: 24 block devices in enclosure group
Enclosure group: [io1-jbof3][io1-jbof3]
NUM         VENDOR            MODEL    REV     SIZE  PATHS
 24 x      SEAGATE   XS15360SE70084   0003   15.4TB      2
Total: 24 block devices in enclosure group
Enclosure group: [io1-jbof1][io1-jbof1]
NUM         VENDOR            MODEL    REV     SIZE  PATHS
 24 x      SEAGATE   XS15360SE70084   0003   15.4TB      2
Total: 24 block devices in enclosure group

ses_report

SES status and environmental metrics.

Used with -c, this command will find all enclosures and then use SES-2 nicknames and use sg_ses to output results suitable for Carbon/Graphite.

$ ses_report -c --prefix=datacenter.stanford
datacenter.stanford.io1-sassw1.Cooling.Left_Fan.speed_rpm 19560 1476486766
datacenter.stanford.io1-sassw1.Cooling.Right_Fan.speed_rpm 19080 1476486766
datacenter.stanford.io1-sassw1.Cooling.Center_Fan.speed_rpm 19490 1476486766
...

Use -s to get the status of all detected SES Element Descriptors.

# ses_report -s --prefix=datacenter.stanford | grep SIM
datacenter.stanford.io1-jbod1-0.Enclosure_services_controller_electronics.SIM_00 OK
datacenter.stanford.io1-jbod1-0.Enclosure_services_controller_electronics.SIM_01 OK
datacenter.stanford.io1-jbod1-0.SAS_expander.SAS_Expander_SIM_0 OK
datacenter.stanford.io1-jbod1-0.SAS_expander.SAS_Expander_ISIM_2 OK
datacenter.stanford.io1-jbod1-0.SAS_expander.SAS_Expander_ISIM_0 OK
datacenter.stanford.io1-jbod1-1.Enclosure_services_controller_electronics.SIM_00 OK
datacenter.stanford.io1-jbod1-1.Enclosure_services_controller_electronics.SIM_01 OK
datacenter.stanford.io1-jbod1-1.SAS_expander.SAS_Expander_SIM_1 OK
datacenter.stanford.io1-jbod1-1.SAS_expander.SAS_Expander_ISIM_3 OK
datacenter.stanford.io1-jbod1-1.SAS_expander.SAS_Expander_ISIM_1 OK

Warning

ses_report requires a recent version of sg3_utils and won't work with the version shipped with CentOS 6 for example.

sas_sd_snic_alias and sas_st_snic_alias

Generate udev aliases using the SES-2 subenclosure nickname and bay identifier of each device. These scripts can also be used as examples and adapted to your specific needs.

For example, for block devices, add the following to your udev rules:

KERNEL=="sd*", PROGRAM="/usr/bin/sas_sd_snic_alias %k", SYMLINK+="%c"

Or, for SAS tape drives behind SAS switches (that act as enclosures):

KERNEL=="st*", PROGRAM="/usr/bin/sas_st_snic_alias %k", SYMLINK+="%c"

This should generate udev aliases made of the device subenclosure nickname followed by the bay identifier. In the following case, io1-jbod1-0 is the subenclosure nickname (here SIM 0 of JBOD #1).

$ ls -l /dev/io1-jbod1-0-bay26
lrwxrwxrwx 1 root root 4 Oct 14 21:00 /dev/io1-jbod1-0-bay26 -> sdab

Note

Use sg_ses --nickname=... to define SES-2 subenclosure nicknames.

sas_mpath_snic_alias

This utility is very similar to sas_sd_snic_alias but only accepts device-mapper devices. Add the following line to your udev rules:

KERNEL=="dm-[0-9]*", PROGRAM="/usr/bin/sas_mpath_snic_alias %k", SYMLINK+="mapper/%c"

This will result in useful symlinks.

$ ls -l /dev/mapper/io1-jbod1-bay26
lrwxrwxrwx 1 root root 8 Oct 14 21:00 /dev/mapper/io1-jbod1-bay26 -> ../dm-31

Note

For sas_mpath_snic_alias to work with a JBOD having two SIMs, both enclosure nicknames should have a common prefix (eg. "myjbodX-") that will be automatically used.

sasutils Python library

Documentation will be available on the wiki.

  • the following example will list all SAS hosts (controllers) found in sysfs

    from sasutils.sas import SASHost
    from sasutils.sysfs import sysfs
    
    # sysfs is a helper to walk through sysfs (/sys)
    for node in sysfs.node('class').node('sas_host'):
    
        # Instantiate SASHost with the sas_host sysfs device class
        host = SASHost(node.node('device'))
    
        # To get its sysfs name, use:
        print(host.name)
        # To get attributes from scsi_host, use:
        print('  %s' % host.scsi_host.attrs.host_sas_address)
        print('  %s' % host.scsi_host.attrs.version_fw)
  • See also https://github.com/stanford-rc/sasutils/wiki/Code-snippets
Author

Stephane Thiell - Stanford Research Computing Center

sasutils's People

Contributors

gdevenyi avatar mlesin avatar santos-lucas avatar sunwire avatar thiell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sasutils's Issues

0.3.12: test suite uses `nose`

nose is already deprecated and shoud not be used with python 3.x https://nose.readthedocs.io/en/latest/

+ /usr/bin/pytest -ra tests/gen_sysfs_testenv.py tests/sysfs.py
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/sasutils-0.3.12
collected 8 items / 1 error / 7 selected

================================================================================== ERRORS ==================================================================================
_______________________________________________________________ ERROR collecting tests/gen_sysfs_testenv.py ________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/sasutils-0.3.12/tests/gen_sysfs_testenv.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/gen_sysfs_testenv.py:23: in <module>
    import nose
E   ModuleNotFoundError: No module named 'nose'
========================================================================= short test summary info ==========================================================================
ERROR tests/gen_sysfs_testenv.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================= 1 error in 0.09s =============================================================================

On migration to pytest usefull could be https://github.com/schollii/nose2pytest/

Add sg3_utils as a general requirement

Hi,

The README states that ses_report requires a recent version of sg3_utils, however it seems sg3_utils (or sg3-utils in Debian/APT) also is required for sas_devices (error, see below), sas_counters (blank output) and the verbose mode of sas_discover (blank output);

root@gridlock:~/bin/sasutils# sas_discover -v
root@gridlock:~/bin/sasutils# sas_discover --verbose
root@gridlock:~/bin/sasutils# sas_counters
root@gridlock:~/bin/sasutils# sas_devices 
Found 1 SAS hosts
Found 1 SAS expanders
Found 1 enclosure groups
Traceback (most recent call last):
  File "/usr/bin/sas_devices", line 9, in <module>
    load_entry_point('sasutils==0.3.2', 'console_scripts', 'sas_devices')()
  File "/usr/lib/python3/dist-packages/sasutils/cli/sas_devices.py", line 303, in main
    sas_devices_cli.print_end_devices(root)
  File "/usr/lib/python3/dist-packages/sasutils/cli/sas_devices.py", line 211, in print_end_devices
    snic = ses_get_snic_nickname(enc.scsi_generic.name)
  File "/usr/lib/python3/dist-packages/sasutils/ses.py", line 39, in ses_get_snic_nickname
    stderr=subprocess.PIPE).communicate()
  File "/usr/lib/python3.4/subprocess.py", line 859, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.4/subprocess.py", line 1457, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'sg_ses'

After installing sg3_utils, they all work as expected.

unpack_from requires a buffer of at least 1 bytes

# sas_devices 
Found 2 SAS hosts
Found 3 SAS expanders
Traceback (most recent call last):
  File "/usr/bin/sas_devices", line 9, in <module>
    load_entry_point('sasutils==0.3.9', 'console_scripts', 'sas_devices')()
  File "/usr/lib/python3.5/site-packages/sasutils/cli/sas_devices.py", line 302, in main
    sas_devices_cli.print_end_devices(root)
  File "/usr/lib/python3.5/site-packages/sasutils/cli/sas_devices.py", line 159, in print_end_devices
    lu = vpd_decode_pg83_lu(pg83)
  File "/usr/lib/python3.5/site-packages/sasutils/vpd.py", line 41, in vpd_decode_pg83_lu
    d, = unpack_from('B', pagebuf, offset + 3)
struct.error: unpack_from requires a buffer of at least 1 bytes

Happens when I attach a specific device (SSD) to the topology.

Not found: '/sys/class/sas_host/host4/device/port-4:3/end_device-4:3/target4:0:3/4:0:3:0/scsi_generic/*[0-9]'

sas_counters, sas_devices, sas_discover, ses_report all fail with the error message Not found: '/sys/class/sas_host/host4/device/port-4:3/end_device-4:3/target4:0:3/4:0:3:0/scsi_generic/*[0-9]'.
The /sys/class/sas_host/host4/device/port-4:3/end_device-4:3/target4:0:3/4:0:3:0/ directory does not contain a scsi_generic directory.
This is my setup: I have a Dell PowerEdge R610 with an HBA in one of the PCIe slots. I then have a SAS SFF-8088 cable that connects to an EMC KTN-STL3 15 bay chassis with some SATA hard disks inside connected to interposers.
I also have a second HBA card connected to the internal backplane of the server with some SATA SSDs connected to it.
lspci shows my HBA cards as Serial Attached SCSI controller: Broadcom / LSI SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] (rev 03).
Is this configuration supported or do I need SAS hard disks for sasutils to work? Maybe my hardware is too weird?
I'm using sasutils installed via Nix (https://github.com/NixOS/nixpkgs/blob/41cc1d5d9584103be4108c1815c350e07c807036/pkgs/os-specific/linux/sasutils/default.nix) but that shouldn't matter. I'm running NixOS but I can also try this on Arch Linux as well if you want.
I'll happily provide any additional information you may need to help you diagnose the issue.

No issue: sg_ses now supports JSON output

Over at https://github.com/doug-gilbert/sg3_utils I recently updated sg_ses to support JSON output. The default is still human readable output and associated with the JSON additions some of the human readable output has been tweaked. Over 2000 lines were added, and around 900 removed, so its a big change. You may like to test that the newer sg_ses does not trip up ses_report .
I would like some feedback on the JSON additions before releasing sg3_utils version 1.48 .

sas_sd_snic_alias outputs warning

The command sas_sd_snic_alias outputs the follow warning:

WARNING:root:sdc not an array device (/sys/block/sdc/device/block/sdc)
Not found: '0x50001ff2343d0400'

And the alias is not created.

My Linux is:

CentOS Linux release 7.3.1611 (Core)
Linux xxxx 3.10.0-514.el7.x86_64 #1 SMP xxxx x86_64 x86_64 x86_64 GNU/Linux

sas_counters: Fix exception when bay_identifier returns EINVAL

Any attempt to read the bay_identifier sysfs file returns EINVAL for some sas_end_devices, it seems. In this case, sas_counters.py errors out with the following traceback because unlike other parts of the code base that touch the bay_identifier attribute, ValueError isn't caught here so far:

(...)
  File "/usr/lib/python2.7/site-packages/sasutils/cli/sas_counters.py", line 101, in portsortfunc
    sortv[2] = int(port_n.end_devices[0].sas_device.attrs
ValueError: invalid literal for int() with base 10: '[Errno 22] Invalid argument'

UTF-8 issue with ses_report in Ubuntu 20.04.1 with sasutils-0.3.10

I downloaded and successfully built/installed the deb packages and most tools work, however ses_report has an UTF-8 error:

# ses_report -c
Traceback (most recent call last):
  File "/usr/bin/ses_report", line 11, in <module>
    load_entry_point('sasutils==0.3.10', 'console_scripts', 'ses_report')()
  File "/usr/lib/python3/dist-packages/sasutils/cli/ses_report.py", line 120, in main
    ses_report()
  File "/usr/lib/python3/dist-packages/sasutils/cli/ses_report.py", line 96, in ses_report
    for edinfo in ses_get_ed_metrics(sg_dev.name):
  File "/usr/lib/python3/dist-packages/sasutils/ses.py", line 87, in ses_get_ed_metrics
    for element_type, descriptor, line in _ses_get_ed_line(sg_name):
  File "/usr/lib/python3/dist-packages/sasutils/ses.py", line 69, in _ses_get_ed_line
    for line in stdout.decode("utf-8").splitlines():
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 48894: invalid start byte

sas_discover: unorderable types in Python 3

$ sas_discover 
Traceback (most recent call last):
  File "/usr/bin/sas_discover", line 9, in <module>
    load_entry_point('sasutils==0.3.8', 'console_scripts', 'sas_discover')()
  File "/usr/lib/python3.4/site-packages/sasutils/cli/sas_discover.py", line 387, in main
    root = SDRootNode(name=root_name, baseobj=root_obj, disp=disp)
  File "/usr/lib/python3.4/site-packages/sasutils/cli/sas_discover.py", line 50, in __init__
    self.resolve()
  File "/usr/lib/python3.4/site-packages/sasutils/cli/sas_discover.py", line 128, in resolve
    self.add_child(SDHostNode, sas_host, last=last)
  File "/usr/lib/python3.4/site-packages/sasutils/cli/sas_discover.py", line 102, in add_child
    self.adv_prompt(self.proffset, last)))
  File "/usr/lib/python3.4/site-packages/sasutils/cli/sas_discover.py", line 50, in __init__
    self.resolve()
  File "/usr/lib/python3.4/site-packages/sasutils/cli/sas_discover.py", line 154, in resolve
    self.add_child(SDExpanderNode, expander, nphys=nphys, last=last)
  File "/usr/lib/python3.4/site-packages/sasutils/cli/sas_discover.py", line 102, in add_child
    self.adv_prompt(self.proffset, last)))
  File "/usr/lib/python3.4/site-packages/sasutils/cli/sas_discover.py", line 50, in __init__
    self.resolve()
  File "/usr/lib/python3.4/site-packages/sasutils/cli/sas_discover.py", line 186, in resolve
    SDHostNode.resolve(self)
  File "/usr/lib/python3.4/site-packages/sasutils/cli/sas_discover.py", line 149, in resolve
    ports = sorted(self.baseobj.ports, key=portsortfunc)
TypeError: unorderable types: tuple() < list()

sas_devices outputs warning

The sas_devices command outputs the follow warnings:

Warning: no enclosure symlink set for sdco in /sys/class/sas_end_device/end_device-12:1:15/device/target12:0:20/12:0:20:0
Warning: sdco not an array device (/sys/class/sas_end_device/end_device-12:1:15/device/sas_device/end_device-12:1:15)
Warning: no enclosure symlink set for sdai in /sys/class/sas_end_device/end_device-1:1:30/device/target1:0:35/1:0:35:0
Warning: sdai not an array device (/sys/class/sas_end_device/end_device-1:1:30/device/sas_device/end_device-1:1:30)

My Linux is:

CentOS Linux release 7.3.1611 (Core)
Linux xxxx 3.10.0-514.el7.x86_64 #1 SMP xxxx x86_64 x86_64 x86_64 GNU/Linux

AttributeError: 'SysfsAttributes' object has no attribute 'sas_address'

I'm setting up a new system identical (in theory) to three other systems on which this works fine. On the new setup I get this error from sas_devices:

# sas_devices
Found 3 SAS hosts
Found 9 SAS expanders
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/sasutils/sysfs.py", line 166, in get
    self.values[key] = sysfs.get(self.paths[key], absolute=True)
KeyError: 'sas_address'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/sas_devices", line 11, in <module>
    load_entry_point('sasutils==0.3.10', 'console_scripts', 'sas_devices')()
  File "/usr/lib/python3.6/site-packages/sasutils/cli/sas_devices.py", line 307, in main
    sas_devices_cli.print_end_devices(root)
  File "/usr/lib/python3.6/site-packages/sasutils/cli/sas_devices.py", line 147, in print_end_devices
    enclosures[encldev.attrs.sas_address] = encldev
  File "/usr/lib/python3.6/site-packages/sasutils/sysfs.py", line 176, in __getitem__
    return self.get(key)
  File "/usr/lib/python3.6/site-packages/sasutils/sysfs.py", line 172, in get
    (self.__class__.__name__, key))
AttributeError: 'SysfsAttributes' object has no attribute 'sas_address'

Multipath is (mostly) working normally but since I usually use sas_devices to troubleshoot that I'm having slow progress figuring out exactly what is causing this to fail.

Create man pages

We need man pages for the main tools. This is a recommendation from reviews of the RPM spec file.

sas_counters: add block device to phy counters when applicable

Nice blog post: https://scottstuff.net/posts/2022/06/04/sas_counters_on_linux/

With current sasutils, we can't resolve which block device is attached to a given SAS phy indeed, but it is easy to implement. The proposed changes are:

Python API:

  • add a new property to the SASPhy class to get the corresponding SASPort object, if any. A SAS phy does not always have a SAS port assigned, but if so, it is directly accessible via sysfs.

sas_counters:

  • add the block device (or if not available, the sg device) to the phy counter lines, when applicable

That way, folks monitoring invalid dword rates or other phy counters might be able to more easily locate a problem with a specific device.

โš ๏ธ This change will add a "node" to the Graphite key for phy counters, as shown below:

Before:

sasutils.sas_counters.fir-io1-s1.HBA_9500-16e.0x500062b20a502a80.SP-3224A-E12EBD.io1-jbof4.phys.0.invalid_dword_count 65 1674797006

After:

sasutils.sas_counters.fir-io1-s1.HBA_9500-16e.0x500062b20a502a80.SP-3224A-E12EBD.io1-jbof4.phys.0.sdcv.invalid_dword_count 65 1674797006
                                                                                                  ^^^^

If no block/sg device can be found for a specific phy, it will display no_port, no_dev or no_target instead of the device name, depending on the situation.

.deb from mkdeb.sh: SyntaxError: invalid syntax

Hi,

Trying to install this as a .deb-package, but yields an error trying to install the .deb-file.

root@gridlock:~# cd bin/
root@gridlock:~/bin# git clone https://github.com/stanford-rc/sasutils.git
Cloning into 'sasutils'...
remote: Counting objects: 473, done.
remote: Total 473 (delta 0), reused 0 (delta 0), pack-reused 473
Receiving objects: 100% (473/473), 91.73 KiB | 0 bytes/s, done.
Resolving deltas: 100% (328/328), done.
Checking connectivity... done.
root@gridlock:~/bin# cd sasutils/
root@gridlock:~/bin/sasutils# apt-get install python3-setuptools python3-stdeb

Then building it;

root@gridlock:~/bin/sasutils# ./mkdeb.sh 
running bdist_deb
running sdist_dsc
running egg_info
creating sasutils.egg-info
writing sasutils.egg-info/PKG-INFO
writing dependency_links to sasutils.egg-info/dependency_links.txt
writing top-level names to sasutils.egg-info/top_level.txt
writing entry points to sasutils.egg-info/entry_points.txt
writing manifest file 'sasutils.egg-info/SOURCES.txt'
reading manifest file 'sasutils.egg-info/SOURCES.txt'
writing manifest file 'sasutils.egg-info/SOURCES.txt'
running sdist
running check
creating sasutils-0.3.2
creating sasutils-0.3.2/sasutils
creating sasutils-0.3.2/sasutils.egg-info
creating sasutils-0.3.2/sasutils/cli
making hard links in sasutils-0.3.2...
hard linking README.rst -> sasutils-0.3.2
hard linking setup.py -> sasutils-0.3.2
hard linking sasutils/__init__.py -> sasutils-0.3.2/sasutils
hard linking sasutils/sas.py -> sasutils-0.3.2/sasutils
hard linking sasutils/scsi.py -> sasutils-0.3.2/sasutils
hard linking sasutils/ses.py -> sasutils-0.3.2/sasutils
hard linking sasutils/smp.py -> sasutils-0.3.2/sasutils
hard linking sasutils/sysfs.py -> sasutils-0.3.2/sasutils
hard linking sasutils/vpd.py -> sasutils-0.3.2/sasutils
hard linking sasutils.egg-info/PKG-INFO -> sasutils-0.3.2/sasutils.egg-info
hard linking sasutils.egg-info/SOURCES.txt -> sasutils-0.3.2/sasutils.egg-info
hard linking sasutils.egg-info/dependency_links.txt -> sasutils-0.3.2/sasutils.egg-info
hard linking sasutils.egg-info/entry_points.txt -> sasutils-0.3.2/sasutils.egg-info
hard linking sasutils.egg-info/top_level.txt -> sasutils-0.3.2/sasutils.egg-info
hard linking sasutils/cli/__init__.py -> sasutils-0.3.2/sasutils/cli
hard linking sasutils/cli/sas_counters.py -> sasutils-0.3.2/sasutils/cli
hard linking sasutils/cli/sas_devices.py -> sasutils-0.3.2/sasutils/cli
hard linking sasutils/cli/sas_discover.py -> sasutils-0.3.2/sasutils/cli
hard linking sasutils/cli/sas_mpath_snic_alias.py -> sasutils-0.3.2/sasutils/cli
hard linking sasutils/cli/sas_sd_snic_alias.py -> sasutils-0.3.2/sasutils/cli
hard linking sasutils/cli/ses_report.py -> sasutils-0.3.2/sasutils/cli
Writing sasutils-0.3.2/setup.cfg
creating dist
Creating tar archive
removing 'sasutils-0.3.2' (and everything under it)
This version of stdeb requires python-all >= 2.6.6-3, but you do not have this package installed. Could not check compatibility.
CALLING dpkg-source -b sasutils-0.3.2 sasutils_0.3.2.orig.tar.gz (in dir deb_dist)
dpkg-source: info: using source format `3.0 (quilt)'
dpkg-source: info: building sasutils using existing ./sasutils_0.3.2.orig.tar.gz
dpkg-source: info: building sasutils in sasutils_0.3.2-1.debian.tar.xz
dpkg-source: info: building sasutils in sasutils_0.3.2-1.dsc
dpkg-buildpackage: warning: using a gain-root-command while being root
dpkg-buildpackage: source package sasutils
dpkg-buildpackage: source version 0.3.2-1
dpkg-buildpackage: source distribution unstable
dpkg-buildpackage: source changed by Stephane Thiell <[email protected]>
 dpkg-source --before-build sasutils-0.3.2
 fakeroot debian/rules clean
dh clean --with python3 --buildsystem=pybuild
   dh_testdir -O--buildsystem=pybuild
   dh_auto_clean -O--buildsystem=pybuild
I: pybuild base:170: python3.4 setup.py clean 
running clean
removing '/root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build' (and everything under it)
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-3.4' does not exist -- can't clean it
   dh_clean -O--buildsystem=pybuild
 dpkg-source -b sasutils-0.3.2
dpkg-source: info: using source format `3.0 (quilt)'
dpkg-source: info: building sasutils using existing ./sasutils_0.3.2.orig.tar.gz
dpkg-source: warning: ignoring deletion of directory sasutils.egg-info
dpkg-source: warning: ignoring deletion of file sasutils.egg-info/dependency_links.txt, use --include-removal to override
dpkg-source: warning: ignoring deletion of file sasutils.egg-info/top_level.txt, use --include-removal to override
dpkg-source: warning: ignoring deletion of file sasutils.egg-info/entry_points.txt, use --include-removal to override
dpkg-source: warning: ignoring deletion of file sasutils.egg-info/PKG-INFO, use --include-removal to override
dpkg-source: warning: ignoring deletion of file sasutils.egg-info/SOURCES.txt, use --include-removal to override
dpkg-source: info: building sasutils in sasutils_0.3.2-1.debian.tar.xz
dpkg-source: info: building sasutils in sasutils_0.3.2-1.dsc
 dpkg-genchanges -S -sa >../sasutils_0.3.2-1_source.changes
dpkg-genchanges: including full source code in upload
 dpkg-source --after-build sasutils-0.3.2
dpkg-buildpackage: full upload (original source is included)
dpkg-source: warning: extracting unsigned source package (sasutils_0.3.2-1.dsc)
dpkg-source: info: extracting sasutils in sasutils-0.3.2
dpkg-source: info: unpacking sasutils_0.3.2.orig.tar.gz
dpkg-source: info: unpacking sasutils_0.3.2-1.debian.tar.xz
dpkg-buildpackage: warning: using a gain-root-command while being root
dpkg-buildpackage: source package sasutils
dpkg-buildpackage: source version 0.3.2-1
dpkg-buildpackage: source distribution unstable
dpkg-buildpackage: source changed by Stephane Thiell <[email protected]>
dpkg-buildpackage: host architecture amd64
 dpkg-source --before-build sasutils-0.3.2
 fakeroot debian/rules clean
dh clean --with python3 --buildsystem=pybuild
   dh_testdir -O--buildsystem=pybuild
   dh_auto_clean -O--buildsystem=pybuild
I: pybuild base:170: python3.4 setup.py clean 
running clean
removing '/root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build' (and everything under it)
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-3.4' does not exist -- can't clean it
   dh_clean -O--buildsystem=pybuild
 debian/rules build
dh build --with python3 --buildsystem=pybuild
   dh_testdir -O--buildsystem=pybuild
   dh_auto_configure -O--buildsystem=pybuild
I: pybuild base:170: python3.4 setup.py config 
running config
   dh_auto_build -O--buildsystem=pybuild
I: pybuild base:170: /usr/bin/python3 setup.py build 
running build
running build_py
creating /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils
copying sasutils/sas.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils
copying sasutils/scsi.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils
copying sasutils/sysfs.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils
copying sasutils/ses.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils
copying sasutils/smp.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils
copying sasutils/vpd.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils
copying sasutils/__init__.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils
creating /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/cli
copying sasutils/cli/sas_counters.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/cli
copying sasutils/cli/ses_report.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/cli
copying sasutils/cli/sas_devices.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/cli
copying sasutils/cli/sas_mpath_snic_alias.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/cli
copying sasutils/cli/__init__.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/cli
copying sasutils/cli/sas_sd_snic_alias.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/cli
copying sasutils/cli/sas_discover.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/cli
   dh_auto_test -O--buildsystem=pybuild
I: pybuild base:170: cd /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build; python3.4 -m unittest discover -v 

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
 fakeroot debian/rules binary
dh binary --with python3 --buildsystem=pybuild
   dh_testroot -O--buildsystem=pybuild
   dh_prep -O--buildsystem=pybuild
   dh_auto_install -O--buildsystem=pybuild
I: pybuild base:170: /usr/bin/python3 setup.py install --root /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils 
running install
running build
running build_py
running install_lib
creating /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr
creating /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib
creating /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4
creating /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages
creating /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils
copying /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/sysfs.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils
copying /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/__init__.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils
copying /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/ses.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils
copying /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/vpd.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils
copying /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/smp.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils
copying /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/scsi.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils
copying /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/sas.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils
creating /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/cli
copying /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/cli/sas_sd_snic_alias.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/cli
copying /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/cli/sas_devices.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/cli
copying /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/cli/sas_counters.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/cli
copying /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/cli/sas_mpath_snic_alias.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/cli
copying /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/cli/ses_report.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/cli
copying /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/cli/__init__.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/cli
copying /root/bin/sasutils/deb_dist/sasutils-0.3.2/.pybuild/pythonX.Y_3.4/build/sasutils/cli/sas_discover.py -> /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/cli
byte-compiling /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/sysfs.py to sysfs.cpython-34.pyc
  File "/usr/lib/python3.4/dist-packages/sasutils/sysfs.py", line 131
    except IOError, exc:
                  ^
SyntaxError: invalid syntax

byte-compiling /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/__init__.py to __init__.cpython-34.pyc
byte-compiling /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/ses.py to ses.cpython-34.pyc
byte-compiling /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/vpd.py to vpd.cpython-34.pyc
byte-compiling /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/smp.py to smp.cpython-34.pyc
byte-compiling /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/scsi.py to scsi.cpython-34.pyc
byte-compiling /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/sas.py to sas.cpython-34.pyc
byte-compiling /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/cli/sas_sd_snic_alias.py to sas_sd_snic_alias.cpython-34.pyc
byte-compiling /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/cli/sas_devices.py to sas_devices.cpython-34.pyc
byte-compiling /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/cli/sas_counters.py to sas_counters.cpython-34.pyc
byte-compiling /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/cli/sas_mpath_snic_alias.py to sas_mpath_snic_alias.cpython-34.pyc
byte-compiling /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/cli/ses_report.py to ses_report.cpython-34.pyc
byte-compiling /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/cli/__init__.py to __init__.cpython-34.pyc
byte-compiling /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils/cli/sas_discover.py to sas_discover.cpython-34.pyc
running install_egg_info
running egg_info
creating sasutils.egg-info
writing dependency_links to sasutils.egg-info/dependency_links.txt
writing entry points to sasutils.egg-info/entry_points.txt
writing sasutils.egg-info/PKG-INFO
writing top-level names to sasutils.egg-info/top_level.txt
writing manifest file 'sasutils.egg-info/SOURCES.txt'
reading manifest file 'sasutils.egg-info/SOURCES.txt'
writing manifest file 'sasutils.egg-info/SOURCES.txt'
Copying sasutils.egg-info to /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/lib/python3.4/dist-packages/sasutils-0.3.2.egg-info
running install_scripts
Installing sas_mpath_snic_alias script to /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/bin
Installing sas_sd_snic_alias script to /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/bin
Installing sas_counters script to /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/bin
Installing sas_devices script to /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/bin
Installing sas_discover script to /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/bin
Installing ses_report script to /root/bin/sasutils/deb_dist/sasutils-0.3.2/debian/python3-sasutils/usr/bin
   dh_installdocs -O--buildsystem=pybuild
   dh_installchangelogs -O--buildsystem=pybuild
   dh_python3 -O--buildsystem=pybuild
   dh_perl -O--buildsystem=pybuild
   dh_link -O--buildsystem=pybuild
   dh_compress -O--buildsystem=pybuild
   dh_fixperms -O--buildsystem=pybuild
   dh_installdeb -O--buildsystem=pybuild
   dh_gencontrol -O--buildsystem=pybuild
   dh_md5sums -O--buildsystem=pybuild
   dh_builddeb -O--buildsystem=pybuild
dpkg-deb: building package `python3-sasutils' in `../python3-sasutils_0.3.2-1_all.deb'.
 dpkg-genchanges -b >../sasutils_0.3.2-1_amd64.changes
dpkg-genchanges: binary-only upload (no source code included)
 dpkg-source --after-build sasutils-0.3.2
dpkg-buildpackage: binary-only upload (no source included)

Then installing...

root@gridlock:~/bin/sasutils# dpkg -i deb_dist/python3-sasutils_0.3.2-1_all.deb 
Selecting previously unselected package python3-sasutils.
(Reading database ... 119148 files and directories currently installed.)
Preparing to unpack .../python3-sasutils_0.3.2-1_all.deb ...
Unpacking python3-sasutils (0.3.2-1) ...
Setting up python3-sasutils (0.3.2-1) ...
  File "/usr/lib/python3/dist-packages/sasutils/sysfs.py", line 131
    except IOError, exc:
                  ^
SyntaxError: invalid syntax

dpkg: error processing package python3-sasutils (--install):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 python3-sasutils

Installed python-related packages;

root@gridlock:~/bin/sasutils# dpkg --list|grep python
ii  dh-python                      1.20141111-2                   all          Debian helper tools for packaging Python libraries and applications
ii  libpython-stdlib:amd64         2.7.9-1                        amd64        interactive high-level object-oriented language (default python version)
ii  libpython2.7:amd64             2.7.9-2+deb8u1                 amd64        Shared Python runtime library (version 2.7)
ii  libpython2.7-minimal:amd64     2.7.9-2+deb8u1                 amd64        Minimal subset of the Python language (version 2.7)
ii  libpython2.7-stdlib:amd64      2.7.9-2+deb8u1                 amd64        Interactive high-level object-oriented language (standard library, version 2.7)
ii  libpython3-stdlib:amd64        3.4.2-2                        amd64        interactive high-level object-oriented language (default python3 version)
ii  libpython3.4-minimal:amd64     3.4.2-1                        amd64        Minimal subset of the Python language (version 3.4)
ii  libpython3.4-stdlib:amd64      3.4.2-1                        amd64        Interactive high-level object-oriented language (standard library, version 3.4)
ii  python                         2.7.9-1                        amd64        interactive high-level object-oriented language (default version)
ii  python-apt                     0.9.3.12                       amd64        Python interface to libapt-pkg
ii  python-apt-common              0.9.3.12                       all          Python interface to libapt-pkg (locales)
ii  python-ceph                    0.80.7-2+deb8u2                amd64        Python libraries for the Ceph distributed filesystem
ii  python-chardet                 2.3.0-1                        all          universal character encoding detector for Python2
ii  python-debian                  0.1.27                         all          Python modules to work with Debian-related data formats
ii  python-debianbts               1.12                           all          Python interface to Debian's Bug Tracking System
ii  python-defusedxml              0.4.1-2                        all          XML bomb protection for Python stdlib modules (for Python 2)
ii  python-docutils                0.12+dfsg-1                    all          text processing system for reStructuredText (implemented in Python 2)
ii  python-flask                   0.10.1-2                       all          micro web framework based on Werkzeug, Jinja2 and good intentions
ii  python-ipaddr                  2.1.11-2                       all          Python module for working with IP addresses, both IPv4 and IPv6
ii  python-itsdangerous            0.24+dfsg1-1                   all          Various helpers to pass trusted data to untrusted environment - python 2.x
ii  python-jinja2                  2.7.3-1                        all          small but fast and easy to use stand-alone template engine
ii  python-markupsafe              0.23-1+b1                      amd64        HTML/XHTML/XML string library for Python
ii  python-minimal                 2.7.9-1                        amd64        minimal subset of the Python language (default version)
ii  python-pkg-resources           5.5.1-1                        all          Package Discovery and Resource Access using pkg_resources
ii  python-protobuf                2.6.1-1                        amd64        Python bindings for protocol buffers
ii  python-pyinotify               0.9.4-1                        all          simple Linux inotify Python bindings
ii  python-reportbug               6.6.3                          all          Python modules for interacting with bug tracking systems
ii  python-requests                2.4.3-6                        all          elegant and simple HTTP library for Python2, built for human beings
ii  python-roman                   2.0.0-1                        all          module for generating/analyzing Roman numerals for Python 2
ii  python-six                     1.8.0-1                        all          Python 2 and 3 compatibility library (Python 2 interface)
ii  python-soappy                  0.12.22-1                      all          SOAP Support for Python
ii  python-support                 1.0.15                         all          automated rebuilding support for Python modules
ii  python-talloc                  2.1.2-0+deb8u1                 amd64        hierarchical pool based memory allocator - Python bindings
ii  python-urllib3                 1.9.1-3                        all          HTTP library with thread-safe connection pooling for Python
ii  python-werkzeug                0.9.6+dfsg-1+deb8u1            all          collection of utilities for WSGI applications
ii  python-wstools                 0.4.3-2                        all          WSDL parsing tools Python module
ii  python2.7                      2.7.9-2+deb8u1                 amd64        Interactive high-level object-oriented language (version 2.7)
ii  python2.7-minimal              2.7.9-2+deb8u1                 amd64        Minimal subset of the Python language (version 2.7)
ii  python3                        3.4.2-2                        amd64        interactive high-level object-oriented language (default python3 version)
ii  python3-all                    3.4.2-2                        amd64        package depending on all supported Python 3 runtime versions
ii  python3-chardet                2.3.0-1                        all          universal character encoding detector for Python3
ii  python3-minimal                3.4.2-2                        amd64        minimal subset of the Python language (default python3 version)
ii  python3-pkg-resources          5.5.1-1                        all          Package Discovery and Resource Access using pkg_resources
ii  python3-requests               2.4.3-6                        all          elegant and simple HTTP library for Python3, built for human beings
iF  python3-sasutils               0.3.2-1                        all          Serial Attached SCSI (SAS) Linux utilities
ii  python3-setuptools             5.5.1-1                        all          Python3 Distutils Enhancements
ii  python3-six                    1.8.0-1                        all          Python 2 and 3 compatibility library (Python 3 interface)
ii  python3-stdeb                  0.8.2-4                        all          Python to Debian source package conversion plugins for distutils
ii  python3-urllib3                1.9.1-3                        all          HTTP library with thread-safe connection pooling for Python3
ii  python3.4                      3.4.2-1                        amd64        Interactive high-level object-oriented language (version 3.4)
ii  python3.4-minimal              3.4.2-1                        amd64        Minimal subset of the Python language (version 3.4)

0.3.13 throws exception when listing the sas devices

After upgrading to 0.3.13, we get following exception when calling sas_devices -v:

[root@host~]# sas_devices -v
Found 2 SAS hosts: host0,host18
SAS expander 0x500c0ff00b41953f x1 (expander-18:0)
SAS expander 0x500c0ff00b46e93f x1 (expander-0:0)
SAS expander 0x500c0ff2f03c571f x1 (expander-18:1)
SAS expander 0x500c0ff2f13efe1f x1 (expander-18:3)
SAS expander 0x500c0ff3f13e699f x1 (expander-0:3)
SAS expander 0x500c0ff3f13e6a9f x1 (expander-0:1)
SAS expander 0x500c0ff4f03c577f x1 (expander-18:2)
SAS expander 0x500c0ff4f13efe7f x1 (expander-18:4)
SAS expander 0x500c0ff5f13e69ff x1 (expander-0:4)
SAS expander 0x500c0ff5f13e6aff x1 (expander-0:2)
Found 10 SAS expanders
Warning: no enclosure symlink set for sde in /sys/class/sas_end_device/end_device-18:1:6/device/target18:0:33/18:0:33:0
Warning: no enclosure symlink set for sdah in /sys/class/sas_end_device/end_device-0:1:6/device/target0:0:33/0:0:33:0
Found 1 enclosure groups
Found 1 orphan devices
Enclosure group: [sg0:LENOVO D32845U12GESM, addr: 0x500c0ff00b46e93e][sg34:LENOVO D32845U12GESM, addr: 0x500c0ff00b41953e]
Traceback (most recent call last):
  File "/bin/sas_devices", line 11, in <module>
    load_entry_point('sasutils==0.3.13', 'console_scripts', 'sas_devices')()
  File "/usr/lib/python3.6/site-packages/sasutils/cli/sas_devices.py", line 283, in main
    sas_devices_cli.print_end_devices(root)
  File "/usr/lib/python3.6/site-packages/sasutils/cli/sas_devices.py", line 233, in print_end_devices
    encdevs = list(filter(enclosure_finder, devmap.items()))
  File "/usr/lib/python3.6/site-packages/sasutils/cli/sas_devices.py", line 229, in enclosure_finder
    if _encl in encset:
UnboundLocalError: local variable '_encl' referenced before assignment

Seems like that the _encl variable is accessed here without being defined/initialized before: https://github.com/stanford-rc/sasutils/blob/master/sasutils/cli/sas_devices.py#L229

The workaround is to either indent the if _encl in encset: block into the parent if block or initialize the _encl variable.

AttributeError: module 'collections' has no attribute 'MutableMapping'

Python: 3.10
OS: Fedora 35
Error:

[root@corsair ~]# sas_discover 
Traceback (most recent call last):
  File "/usr/bin/sas_discover", line 33, in <module>
    sys.exit(load_entry_point('sasutils==0.3.11', 'console_scripts', 'sas_discover')())
  File "/usr/bin/sas_discover", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib64/python3.10/importlib/metadata/__init__.py", line 162, in load
    module = import_module(match.group('module'))
  File "/usr/lib64/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.10/site-packages/sasutils/cli/sas_discover.py", line 25, in <module>
    from sasutils.sas import SASHost
  File "/usr/lib/python3.10/site-packages/sasutils/sas.py", line 18, in <module>
    from sasutils.scsi import BlockDevice, SCSIDevice, SCSIHost
  File "/usr/lib/python3.10/site-packages/sasutils/scsi.py", line 19, in <module>
    from sasutils.sysfs import SysfsDevice, SysfsObject
  File "/usr/lib/python3.10/site-packages/sasutils/sysfs.py", line 144, in <module>
    class SysfsAttributes(collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'

Using or importing the MutableMapping from 'collections' instead of from 'collections.abc' is deprecated since Python 3.8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.