zed: Control NVMe fault LEDs

The ZED code currently can only turn on the fault LED for
a faulted disk in a JBOD enclosure.  This extends support
for faulted NVMe disks as well.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #12648
Closes #12695
This commit is contained in:
Tony Hutter
2021-11-09 16:50:18 -08:00
committed by GitHub
parent e39fe05b69
commit ae70d628ff
5 changed files with 229 additions and 11 deletions
+9
View File
@@ -27,6 +27,7 @@
#include <math.h>
#include <stdio.h>
#include <libzutil.h>
#include <string.h>
/*
* Return B_TRUE if "str" is a number string, B_FALSE otherwise.
@@ -42,6 +43,14 @@ zfs_isnumber(const char *str)
if (!(isdigit(*str) || (*str == '.')))
return (B_FALSE);
/*
* Numbers should not end with a period ("." ".." or "5." are
* not valid)
*/
if (str[strlen(str) - 1] == '.') {
return (B_FALSE);
}
return (B_TRUE);
}