2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-31 10:06:39 +00:00

confignetwork support mtu (#2973)

This commit is contained in:
Yuan Bai 2017-05-05 15:34:05 +08:00 committed by yangsong
parent f3531240d3
commit ec357428e4

View File

@ -312,6 +312,7 @@ function query_nicnetworks_nic {
function query_nicnetworks_net {
query_nicnetworks fkey=1 vkey=$1 fval=2
}
#######################################################################################
#
# get network attribute from NETWORKS_LINEX
@ -419,6 +420,7 @@ function create_persistent_ifcfg {
local xcatnet=""
local _ipaddr=""
local _netmask=""
local _mtu=""
local inattrs=""
# parser input arguments
@ -430,6 +432,7 @@ function create_persistent_ifcfg {
[ "$key" = "xcatnet" ] || \
[ "$key" = "_ipaddr" ] || \
[ "$key" = "_netmask" ] || \
[ "$key" = "_mtu" ] || \
[ "$key" = "inattrs" ]; then
eval "$1"
fi
@ -452,6 +455,12 @@ function create_persistent_ifcfg {
if [ -z "$_netmask" ]; then
_netmask=`get_network_attr $xcatnet mask`
fi
# Query mtu value from "networks" table
if [ -z "$_mtu" ]; then
_mtu=`get_network_attr $xcatnet mtu`
fi
fi
local attrs=""
attrs=${attrs}${attrs:+,}"DEVICE=$ifname"
@ -460,6 +469,8 @@ function create_persistent_ifcfg {
attrs=${attrs}${attrs:+,}"IPADDR=$_ipaddr"
[ -n "$_netmask" ] && \
attrs=${attrs}${attrs:+,}"NETMASK=$_netmask"
[ -n "$_mtu" ] && \
attrs=${attrs}${attrs:+,}"MTU=$_mtu"
# NetworkManager attributes
attrs=${attrs}${attrs:+,}"NAME=$ifname"
@ -817,6 +828,11 @@ function create_bridge_interface {
log_info "Pickup xcatnet, \"$xcatnet\", from NICNETWORKS for interface \"$ifname\"."
fi
# Query mtu value from "networks" table
if [ -z "$_mtu" ]; then
_mtu=`get_network_attr $xcatnet mtu`
fi
if [ x$_pretype == "xethernet" ]; then
create_raw_ethernet_for_br \
ifname=$_port \
@ -933,6 +949,11 @@ function create_ethernet_interface {
return 1
fi
# Query mtu value from "networks" table
if [ -z "$_mtu" ]; then
_mtu=`get_network_attr $xcatnet mtu`
fi
# define and bring up interface
cfg=""
cfg="${cfg}${cfg:+,}ONBOOT=yes"
@ -1015,6 +1036,11 @@ function create_vlan_interface {
log_info "Pickup xcatnet, \"$xcatnet\", from NICNETWORKS for interface \"$ifname\"."
fi
# Query mtu value from "networks" table
if [ -z "$_mtu" ]; then
_mtu=`get_network_attr $xcatnet mtu`
fi
#load the 8021q module if not loaded.
load_kmod module=8021q retry=10 interval=0.5
@ -1186,7 +1212,12 @@ function create_bond_interface {
if [ -n "$_bonding_opts" ]; then
_bonding_opts=`echo "$_bonding_opts" | $sed -e 's/,/ /g'`
fi
# Query mtu value from "networks" table
if [ -z "$_mtu" ]; then
_mtu=`get_network_attr $xcatnet mtu`
fi
##############################
# Create target bond interface
# if target bond device was already exists, assume succ.