Skip to content

Commit

Permalink
Print message to stderr when using storcli2 to get SLOT_NUM
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaboud committed Aug 22, 2023
1 parent b74a4f7 commit eb444d6
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 10 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
## 45drives-tools 3.0.0-6
## 45drives-tools 3.0.0-7

* Fixed id_disk for case where controller has no drives
* Fixed udev rule to grab slot attr from parent of scsi block dev
* Print message to stderr when using storcli2 to get SLOT_NUM
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "45drives-tools",
"prerelease": true,
"version": "3.0.0",
"buildVersion": "6",
"buildVersion": "7",
"author": "Mark Hooper <mhooper@45drives.com>",
"url": "https://github.com/45Drives/tools",
"category": "utils",
Expand Down Expand Up @@ -66,7 +66,7 @@
"changelog": {
"urgency": "medium",
"version": "3.0.0",
"buildVersion": "6",
"buildVersion": "7",
"ignore": [],
"date": null,
"packager": "Mark Hooper <mhooper@45drives.com>",
Expand Down
2 changes: 2 additions & 0 deletions packaging/el7/main.spec
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ fi
/usr/lib/udev/rules.d/*

%changelog
* Tue Aug 22 2023 Joshua Boudreau <jboudreau@45drives.com> 3.0.0-7
- Print message to stderr when using storcli2 to get SLOT_NUM
* Tue Aug 22 2023 Joshua Boudreau <jboudreau@45drives.com> 3.0.0-6
- Fixed id_disk for case where controller has no drives
- Fixed udev rule to grab slot attr from parent of scsi block dev
Expand Down
2 changes: 2 additions & 0 deletions packaging/el8/main.spec
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ fi
/usr/lib/udev/rules.d/*

%changelog
* Tue Aug 22 2023 Joshua Boudreau <jboudreau@45drives.com> 3.0.0-7
- Print message to stderr when using storcli2 to get SLOT_NUM
* Tue Aug 22 2023 Joshua Boudreau <jboudreau@45drives.com> 3.0.0-6
- Fixed id_disk for case where controller has no drives
- Fixed udev rule to grab slot attr from parent of scsi block dev
Expand Down
6 changes: 6 additions & 0 deletions packaging/focal/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
45drives-tools (3.0.0-7focal) focal; urgency=medium

* Print message to stderr when using storcli2 to get SLOT_NUM

-- Joshua Boudreau <jboudreau@45drives.com> Tue, 22 Aug 2023 13:49:50 -0300

45drives-tools (3.0.0-6focal) focal; urgency=medium

* Fixed id_disk for case where controller has no drives
Expand Down
8 changes: 3 additions & 5 deletions ubm/67-ubm.rules
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
# Disk rules
################################
# if slot attribute is exposed in sysfs (using patched mpi3mr driver), assign to ENV{SLOT_NUM} to avoid running storcli2 for every device
SUBSYSTEMS=="scsi", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", ATTRS{slot}=="?*", ENV{SLOT_NUM}="$attrs{slot}"
SUBSYSTEMS=="scsi", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", ATTRS{slot}=="?*", IMPORT{parent}="SLOT_NUM"
# fill in remaining ENV variables with ubm/id_disk (SLOT_NUM, SLOT_NAME, DISK_HANDLED_BY_UBM, UBM_MAP_KEY, STORCLI2_CTRL_NUM, STORCLI2_EID)
SUBSYSTEMS=="scsi", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", IMPORT{program}="/opt/45drives/ubm/id_disk %k"
SUBSYSTEMS=="scsi", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", IMPORT{program}="/opt/45drives/ubm/id_disk %k"
SUBSYSTEMS=="scsi", DRIVERS=="sd", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk|partition", ATTRS{slot}=="?*", ENV{SLOT_NUM}="$attr{slot}"
# fill in remaining ENV variables with ubm/id_disk (SLOT_NUM if missing, SLOT_NAME, UBM_MAP_KEY)
SUBSYSTEMS=="scsi", DRIVERS=="sd", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk|partition", IMPORT{program}="/opt/45drives/ubm/id_disk %k"

# DISK_HANDLED_BY_UBM environment variable will make udev skip rules in 68-vdev.rules
ENV{SUBSYSTEM}=="block", ENV{SLOT_NUM}=="?*", ENV{DISK_HANDLED_BY_UBM}="1"
Expand Down
2 changes: 2 additions & 0 deletions ubm/id_disk
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ if [ "$DEVTYPE" = "partition" ]; then
fi

if [ -z "$SLOT_NUM" ]; then
echo "INFO: querying slot number from storcli2. Issue with mpi3mr reporting slot attr?" >&2
set_env_var WARN_GOT_SLOT_NUM_FROM_STORCLI2 1
SLOT_NUM=$(
set -o pipefail
/opt/45drives/tools/storcli2 /call/eall/sall show all J | jq -re '
Expand Down

0 comments on commit eb444d6

Please sign in to comment.