Skip to content

Commit

Permalink
Retry ipmitool lan set if it fails the first time (#152)
Browse files Browse the repository at this point in the history
* Add drac.ipv4 to the stage1 kernel arguments.

* Install ipmitool in the stage1_minimal image.

* WIP: add logic to configure DRAC only if not previously configured.

* Add '-y' to apt-get install.

* Add sleep 60 to stage1's rc.local.

* Fix typo and change awk to not use the --posix option (unsupported).

* Fix syntax.

* Move DRAC configuration to a separate function.

* Actually configure DRAC.

* Add debug strings.

* Fix variable name.

* Add debug sleep.

* Move code under the setup_drac function and add more debugging stuff.

* Add set -o pipefail.

* Fix a few things.

* Remove debug stuff.

* Fix formatting.

* Add logrun() function to avoid echoing commands.

* Retry ipmitool lan set if it fails the first time.

On R640s/DRAC9, changing the IP address takes a long time and ipmitool
has a shorter timeout, thus it assumes the configuration failed and
returns a non-zero exit code. To make this script a bit more robust,
we wait 30 seconds and try again.

Should it fail again, there are two possible cases:

1. Setting the IP address on this DRAC takes a *very* long time, but
   it eventually works
2. Setting the IP address on this DRAC does not work, for reasons we
   do not know.

In both cases, there isn't anything else we can do during stage1.
  • Loading branch information
robertodauria authored Oct 23, 2019
1 parent 242ee36 commit 27b3c7c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions configs/stage1_minimal/rc.local
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ function setup_drac() {
logrun ipmitool user set password 2 "m3@sur3m3nt" 20
logrun ipmitool lan set 1 ipsrc static
logrun ipmitool lan set 1 ipaddr $drac_ipv4
# On Dell R640 and iDRAC 9, setting the IP address takes longer than
# ipmitool's timeout, thus the command above returns a non-zero exit
# code. Since the DRAC configuration normally only happens once,
# there is no harm in waiting some more time and retrying, here.
if [ $? -ne 0 ]; then
echo "DRAC's IP address has not changed yet. Retrying in 30s..."
sleep 30
logrun ipmitool lan set 1 ipaddr $drac_ipv4
fi
logrun ipmitool lan set 1 netmask 255.255.255.192
logrun ipmitool lan set 1 defgw ipaddr $gateway
)
Expand Down

0 comments on commit 27b3c7c

Please sign in to comment.