-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Enclosure LED fixes #5751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enclosure LED fixes #5751
Conversation
@tonyhutter, thanks for your PR! By analyzing the history of the files in this pull request, we identified @dun, @don-brady and @behlendorf to be potential reviewers. |
This will fix #5716 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The approach LGTM but the patch causes zpool_status_001_neg
and zpool_iostat_005_pos
to fail so that'll need to be resolved. The other two test failures can be fixed with a rebase on master.
@@ -6,6 +6,7 @@ | |||
. "${ZED_ZEDLET_DIR}/zed-functions.sh" | |||
|
|||
zed_log_msg "eid=${ZEVENT_EID}" "class=${ZEVENT_SUBCLASS}" \ | |||
"${ZEVENT_POOL:+"pool=${ZEVENT_POOL}"}" \ | |||
"${ZEVENT_POOL_GUID:+"pool_guid=${ZEVENT_POOL_GUID}"}" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be useful to log both here if the reason for the change is to minimize ambiguity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had it looking up the pool name in an earlier version of the code, but later decided against it. The problem was that we would get some events before the pool was fully imported, and so we couldn't resolve the pool name. The other issue is that each pool name lookup (zed_guid_to_pool
) does a zpool get
call, which I thought was a little heavyweight for code that runs on each event.
cmd/zed/zed.d/statechange-led.sh
Outdated
|
||
# Lookup all the current LED values and paths in parallel | ||
cmd='echo led_token=$(cat "$VDEV_ENC_SYSFS_PATH/fault"),"$VDEV_ENC_SYSFS_PATH",' | ||
out=$(zpool status -vc "$cmd" $pool | grep 'led_token=') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ZPOOL
should be provided in the environment.
cmd/zed/zed.d/zed-functions.sh
Outdated
|
||
guid=$(printf "%llu" $1) | ||
if [ ! -z "$guid" ] ; then | ||
zpool get -H -ovalue,name guid | awk '$1=='$guid' {print $2}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same: $ZPOOL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both $ZPOOLs are fixed in latest push
cmd/zpool/zpool_iter.c
Outdated
if (snprintf(cmd, sizeof (cmd), "VDEV_PATH=%s && VDEV_UPATH=\"%s\" && " | ||
"VDEV_ENC_SYSFS_PATH=\"%s\" && %s", data->path, | ||
data->upath, data->vdev_enc_sysfs_path, | ||
data->cmd) >= sizeof (cmd)) { | ||
/* Our string was truncated */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will snprintf
and strdup
(below) always handle a NULL vdev_enc_sysfs_path
value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, it's fixed in my latest push.
I currently don't have access to my VM, so haven't looked into the test failures yet. I'm hoping I get lucky and they go away with my latest push :-) |
@tonyhutter a rebase on master should get rid of the two reservation test failures. |
- Pass $VDEV_ENC_SYSFS_PATH to 'zpool [iostat|status] -c' to include enclosure LED sysfs path. - Set LEDs correctly after import. This includes clearing any erroniously set LEDs prior to the import, and setting the LED for any UNAVAIL drives. - Include symlink for vdev_attach-led.sh in Makefile.am. - Print the VDEV path in all-syslog.sh, and fix it so the pool GUID actually prints.
4ebbe24
to
fd99878
Compare
Ok, I think I've got everything fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
- Pass $VDEV_ENC_SYSFS_PATH to 'zpool [iostat|status] -c' to include enclosure LED sysfs path. - Set LEDs correctly after import. This includes clearing any erroniously set LEDs prior to the import, and setting the LED for any UNAVAIL drives. - Include symlink for vdev_attach-led.sh in Makefile.am. - Print the VDEV path in all-syslog.sh, and fix it so the pool GUID actually prints. Reviewed-by: Don Brady <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes openzfs#5716 Closes openzfs#5751
- Pass $VDEV_ENC_SYSFS_PATH to 'zpool [iostat|status] -c' to include enclosure LED sysfs path. - Set LEDs correctly after import. This includes clearing any erroniously set LEDs prior to the import, and setting the LED for any UNAVAIL drives. - Include symlink for vdev_attach-led.sh in Makefile.am. - Print the VDEV path in all-syslog.sh, and fix it so the pool GUID actually prints. Reviewed-by: Don Brady <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes openzfs#5716 Closes openzfs#5751
- Pass $VDEV_ENC_SYSFS_PATH to 'zpool [iostat|status] -c' to include enclosure LED sysfs path. - Set LEDs correctly after import. This includes clearing any erroniously set LEDs prior to the import, and setting the LED for any UNAVAIL drives. - Include symlink for vdev_attach-led.sh in Makefile.am. - Print the VDEV path in all-syslog.sh, and fix it so the pool GUID actually prints. Reviewed-by: Don Brady <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes openzfs#5716 Closes openzfs#5751
Various enclosure LED zed fixes.
Description
Pass $VDEV_ENC_SYSFS_PATH to 'zpool [iostat|status] -c' to include
enclosure LED sysfs path.
Set LEDs correctly after import. This includes clearing any erroniously
set LEDs prior to the import, and setting the LED for any UNAVAIL drives.
Include missing symlink for vdev_attach-led.sh in Makefile.am.
Print the VDEV path in all-syslog.sh, and fix it so the pool GUID actually
prints.
Motivation and Context
How Has This Been Tested?
Types of changes
Checklist: