Merge "dhcp-all-interfaces.sh - Add support for InfiniBand interface DHCP"

This commit is contained in:
Jenkins 2017-06-02 06:11:19 +00:00 committed by Gerrit Code Review
commit 5a045e036d

View File

@ -41,6 +41,10 @@ function get_if_link() {
cat /sys/class/net/${1}/carrier || echo 0
}
function get_if_type() {
cat /sys/class/net/${1}/type
}
function enable_interface() {
local interface=$1
@ -48,7 +52,11 @@ function enable_interface() {
if [ "$CONF_TYPE" == "eni" ]; then
printf "auto $interface\niface $interface inet dhcp\n\n" >>$ENI_FILE
elif [ "$CONF_TYPE" == "rhel-netscripts" ]; then
if [ "$(get_if_type $interface)" == "32" ]; then
printf "DEVICE=\"$interface\"\nBOOTPROTO=\"dhcp\"\nONBOOT=\"yes\"\nTYPE=\"InfiniBand\"\nCONNECTED_MODE=\"no\"\nDEFROUTE=\"yes\"\nPEERDNS=\"yes\"\nPEERROUTES=\"yes\"\nIPV4_FAILURE_FATAL=\"yes\"\nIPV6INIT=\"no\"" >"${SCRIPTS_PATH}ifcfg-$interface"
else
printf "DEVICE=\"$interface\"\nBOOTPROTO=\"dhcp\"\nONBOOT=\"yes\"\nTYPE=\"Ethernet\"" >"${SCRIPTS_PATH}ifcfg-$interface"
fi
elif [ "$CONF_TYPE" == "suse-netscripts" ]; then
printf "BOOTPROTO=\"dhcp\"\nSTARTMODE=\"auto\"" >"${SCRIPTS_PATH}ifcfg-$interface"
fi
@ -56,6 +64,7 @@ function enable_interface() {
}
function config_exists() {
local interface=$1
if [[ "$CONF_TYPE" =~ "netscripts" ]]; then