Skip to content

Commit b023d19

Browse files
authored
🌱 More logging in check-disk.sh (#1505)
* 🌱 More logging in check-disk.sh We found a strange issue with the check-disk.sh script. We add more output to the script, so that we can debug that better if it happens again. No fix, just more logging. And the regex for valid WWNs was extended.
1 parent 1904cab commit b023d19

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

pkg/services/baremetal/client/ssh/check-disk.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ for wwn in "$@"; do
8787
echo "Failed to find device for WWN $wwn"
8888
exit 3
8989
fi
90-
smartctl -H "/dev/$device" | { grep -vP '^(smartctl \d+\.\d+.*|Copyright|=+ START OF)' || true; } |
90+
echo "Checking WWN=$wwn device=$device"
91+
{ smartctl -H "/dev/$device" || true; } | { grep -vP '^(smartctl \d+\.\d+.*|Copyright|=+ START OF)' || true; } |
9192
{ grep -v '^$' || true; } |
92-
sed "s#^#$wwn (/dev/$device): #" >>"$result"
93+
{ sed "s#^#$wwn (/dev/$device): #" || true; } >>"$result"
9394
done
9495
errors=$(grep -v PASSED "$result" || true)
9596
if [ -n "$errors" ]; then
@@ -98,5 +99,7 @@ if [ -n "$errors" ]; then
9899
echo "$errors"
99100
exit 1
100101
fi
102+
echo "check-disk passed. Provided WWNs look healthy."
103+
echo
101104
cat "$result"
102105
exit 0

pkg/services/baremetal/client/ssh/ssh_client.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,9 +573,10 @@ chmod a+rx /root/detect-linux-on-another-disk.sh
573573
}
574574

575575
var (
576-
// I found no details about the format. I found these examples
577-
// 10:00:00:05:1e:7a:7a:00 eui.00253885910c8cec 0x500a07511bb48b25
578-
isValidWWNRegex = regexp.MustCompile(`^[0-9a-zA-Z.:-]{5,64}$`)
576+
// I found no details about the format. I found these examples:
577+
// 10:00:00:05:1e:7a:7a:00 eui.00253885910c8cec 0x500a07511bb48b25 alias.CDIMS1_A3:20:54:d0:39:ea:3d:b8:74
578+
// https://www.reddit.com/r/zfs/comments/1glttvl/validate_wwn/
579+
isValidWWNRegex = regexp.MustCompile(`^[0-9a-zA-Z._=:-]{5,64}$`)
579580

580581
// ErrInvalidWWN indicates that a WWN has an invalid syntax.
581582
ErrInvalidWWN = fmt.Errorf("WWN does not match regex %q", isValidWWNRegex.String())

0 commit comments

Comments
 (0)