-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnodeman_util_dell.bash
303 lines (269 loc) · 7.06 KB
/
nodeman_util_dell.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# Copyright 2025, Battelle Energy Alliance, LLC
#
# Author:
# Scott Serr
#
# Description:
# Dell specific functions involving RACADM
#
# We can't hide the password well for racadm
export NM_RACADM="/opt/dell/srvadmin/sbin/racadm -u $NM_IPMI_USER -p $NM_IPMI_PASS"
export NM_BIOS_SETTINGS_FILE=$NM_DATA/golden.json
export NM_CM_FIRM_DIR=$NM_DATA/cm
export NM_FIRMWARE_INSTALLER="/shared/firmware/C6620/install-firmware.sh reboot"
nm.system.set.thermalprofile () {
single () {
h=$1.drac.cluster
TP="$2"
$NM_RACADM -r $h set System.ThermalSettings.ThermalProfile "$TP"
}
export -f single
if [[ "$1" == "min" ]]; then
TP="Minimum Power"
elif [[ "$1" == "max" ]]; then
TP="Maximum Performance"
else
TP="Default Thermal Profile Settings"
fi
nm._parallel single {} \"$TP\"
}
nm.bmc.taskclear () {
single () {
h=$1.drac.cluster
OUT=$($NM_RACADM -r $h jobqueue delete --all)
echo "$1 $OUT"
}
export -f single
nm._parallel single
}
nm.system.get.thermalprofile () {
single () {
h=$1.drac.cluster
OUT=$($NM_RACADM -r $h get System.ThermalSettings.ThermalProfile | grep ^ThermalProfile | cut -d= -f2)
echo "$1 $OUT"
}
export -f single
nm._parallel single
}
nm.biosconfig.update () {
single () {
h=$1.drac.cluster
echo $h
$NM_RACADM -r $h set iDRAC.Lockdown.SystemLockdown 0
sleep 2
$NM_RACADM -r $h set -t json -f $NM_BIOS_SETTINGS_FILE
# sleep 2
# $NM_RACADM -r $h jobqueue create BIOS.Setup.1-1 -r forced
}
export -f single
nm._parallel single
}
nm.biosconfig.fetch () {
single () {
h=$1.drac.cluster
outf=$NM_NODES_DIR/$1-biosconfig.json
outfc=$NM_NODES_DIR/$1-biosconfig-component.json
outff=$NM_NODES_DIR/$1-allsettings.json
# others we might want NIC.Embedded.1-1-1 iDRAC.Embedded.1
outc=$($NM_RACADM -r $h get -t json -c BIOS.Setup.1-1 -f $outf | grep "configuration")
jq '.SystemConfiguration.Components' $outf > $outfc
sleep 5
$NM_RACADM -r $h get -t json -f $outff > /dev/null
echo $1 $outf $outc
}
export -f single
nm._parallel single
}
nm.bios.get.bootmode () {
single () {
h=$1.drac.cluster
$NM_RACADM -r $h get bios.biosbootsettings.BootMode | grep -v "Key"
}
export -f single
nm._parallel single
}
nm.bios.get.logicalproc () {
single () {
h=$1.drac.cluster
$NM_RACADM -r $h get BIOS.ProcSettings.LogicalProc | grep "Log"
}
export -f single
nm._parallel single
}
nm.bios.set.logicalproc.on () {
single () {
h=$1.drac.cluster
$NM_RACADM -r $h set iDRAC.Lockdown.SystemLockdown 0
sleep 2
$NM_RACADM -r $h set BIOS.ProcSettings.LogicalProc Enabled
sleep 2
$NM_RACADM -r $h jobqueue create BIOS.Setup.1-1 -r forced
}
export -f single
nm._parallel single
}
nm.chassistag () {
single () {
h=$1.drac.cluster
$NM_RACADM -r $h getsysinfo | grep "Chassis Service Tag"
}
export -f single
nm._parallel single
}
nm.firmware._check () {
DES_BMC="7.10.50.10"
DES_BIOS="2.2.8"
h=$1
OUT=$($NM_RACADM -r $h.drac.cluster getsysinfo)
BMC=$(echo "$OUT" | grep "Firmware Version" | sed -n 's/.* = \(.*\)/\1/p')
BIOS=$(echo "$OUT" | grep "System BIOS Version" | sed -n 's/.* = \(.*\)/\1/p')
echo "$h -- BMC $BMC (Desired $DES_BMC) BIOS $BIOS (Desired $DES_BIOS)" > /dev/stderr
if [[ "$BIOS" != "" && "$BMC" != "" ]]; then
#echo "$DES_BMC $BMC $DES_BIOS $BIOS"
if [[ "$DES_BMC" == "$BMC" && "$DES_BIOS" == "$BIOS" ]]; then
exit 0
else
exit 1
fi
fi
exit 2
}
# for gnu parallel to call the fuction
export -f nm.firmware._check
nm.firmware.needed () {
single () {
h=$1
$(nm.firmware._check $h)
ret=$?
if [ $ret -eq 1 ]; then
echo "needed"
fi
}
export -f single
nm._parallel -j100 single
}
nm.firmware.good () {
single () {
h=$1
$(nm.firmware._check $h)
ret=$?
if [ $ret -eq 0 ]; then
echo "good"
fi
}
export -f single
nm._parallel -j0 single
}
nm.chassis.firmware.version () {
single () {
h=$1
OUT=$($NM_RACADM -r $h.drac.cluster getsysinfo)
CHASSIS=$(echo "$OUT" | grep "Chassis Manager Version" | sed -n 's/.* = \(.*\)/\1/p')
echo "$CHASSIS"
}
export -f single
nm._parallel -j0 single
}
export -f nm.chassis.firmware.version # so the update can reuse this
nm.firmware.all.versions () {
single () {
h=$1
(
$NM_RACADM -r $h.drac.cluster getsysinfo
$NM_RACADM -r $h.drac.cluster get bios.sysinformation | grep -v "SystemServiceTag"
$NM_RACADM -r $h.drac.cluster getversion
) | grep -i Version | tr -d '\r' | tr -d ' ' | grep '\S'
}
export -f single
nm._parallel -j0 single
}
nm.firmware.update () {
single() {
nm._log "$1 nm.firmware.update start"
sudo ssh $1 "$NM_FIRMWARE_INSTALLER" < /dev/null &> /tmp/nm.firmware.update.$1.log
nm._log "$1 firmware.update complete"
echo "update complete"
}
export -f single
if [[ "$1" != "" ]]; then
echo $1 | nm.firmware.update
else
nm._parallel -j0 --delay .1 --timeout 20m --line-buffer single
fi
}
nm.bmc.sslpush () {
single() {
h=$1.drac.cluster
IP=$(getent hosts $h | awk '{ print $1 }')
echo $IP
CMD="$NM_RACADM -r $IP"
# does this first command do anything? -SMS
$CMD set idrac.webserver.HostHeaderCheck 0
$CMD sslkeyupload -t 1 -f $NM_DATA/ssl-self-signed/drac.cluster.key
$CMD sslcertupload -t 1 -f $NM_DATA/ssl-self-signed/drac.cluster.crt
$CMD racreset
}
export -f single
nm._parallel -j0 single
}
nm.identify.status () {
single () {
h=$1
$NM_RACADM -r $h.drac.cluster getled | grep "LED"
}
export -f single
if [[ "$1" != "" ]]; then
single $1
else
nm._parallel -j0 single
fi
}
nm.sel.viewroll () {
single () {
h=$1
R=$($NM_RACADM -r $h.drac.cluster getsysinfo | grep "Roll")
E=$($NM_IPMI -H $h.bmc sel elist | grep "Assert" | tail -n1)
if [[ "$R" == *"RollupStatus"* ]]; then
echo "$R $E"
else
echo "Failed"
fi
}
export -f single
nm._parallel single
}
# nm.firmware.cpld.update () {
# single() {
# sudo ssh $1 "$NM_FIRMWARE_DIR/compute/other/CPLD/CPLD_Firmware_XR7JW_LN_1.1.0_A00.BIN -q" < /dev/null &>> /tmp/nm.firmware.update.$1.log
# }
# export -f single
# nm._parallel -j0 --delay .1 --timeout 20m --line-buffer single
# }
# nm.chassis.firmware.update_2.70_3.51 () {
# single () {
# # check if host is less than 2.70, then install 2.70
# h=$1
# V=$(echo $h | nm.chassis.firmware.version | cut -f2 -d" ")
# echo $V
# if (( $(echo "$V < 2.70" | bc -l) )); then
# echo "Upgrading $V to 2.70 ????"
# $NM_RACADM -r $h.drac.cluster update -f $NM_CM_FIRM_DIR/cm_2.70/cm.sc
# fi
# # check if host is 2.70 or greater but less than 3.51, then install 3.51
# if (( $(echo "$V >= 2.70 && $V < 3.51" | bc -l) )); then
# echo "Upgrading $V to 3.51 ????"
# $NM_RACADM -r $h.drac.cluster update -f $NM_CM_FIRM_DIR/cm_3.51/cm.sc
# fi
# }
# export -f single
# nm._parallel single
# }
#nm.chassis.firmware.update () {
# single () {
# h=$1
# $NM_RACADM -r $h.drac.cluster update -f $NM_FIRMWARE_DIR/other/Chassis_Management/cm.sc
# }
# export -f single
# nm._parallel -j0 --delay .1 --timeout 10m single
#}