2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-12-03 07:37:09 +00:00

Honor vlan tagging in the EL8+ diskful identity images

This allows nodes booting with identity image to deal with vlan tags.
This commit is contained in:
Jarrod Johnson
2026-12-02 16:14:45 -05:00
parent df505c9b9b
commit f1fbb8ccd1
@@ -58,6 +58,10 @@ if [ -e /dev/disk/by-label/CNFLNT_IDNT ]; then
sed -n '/^net_cfgs:/, /^[^- ]/{/^[^- ]/!p}' cnflnt.yml |sed -n '/^-/, /^-/{/^-/!p}'| sed -e 's/^[- ]*//'> $tcfg
autoconfigmethod=$(grep ^ipv4_method: $tcfg)
autoconfigmethod=${autoconfigmethod#ipv4_method: }
nicvlanid=$(grep ^vlan_id: $tcfg | awk '{print $2}' | sed -e "s/'//g" -e s/null//)
if [ -n "$nicvlanid" ]; then
echo "$nicvlanid" > /tmp/confluent.vlanid
fi
for i in /sys/class/net/*; do
ip link set $(basename $i) down
udevadm info $i | grep ID_NET_DRIVER=cdc_ether > /dev/null && continue
@@ -68,8 +72,18 @@ if [ -e /dev/disk/by-label/CNFLNT_IDNT ]; then
while [ "$DETECTED" = 0 ] && [ $TRIES -gt 0 ]; do
TRIES=$((TRIES - 1))
for NICGUESS in $(ip link|grep LOWER_UP|grep -v LOOPBACK| awk '{print $2}' | sed -e 's/:$//'); do
vlanarg=""
if [ -n "$nicvlanid" ]; then
ip link add link $NICGUESS name $NICGUESS.$nicvlanid type vlan id $nicvlanid
ip link set $NICGUESS.$nicvlanid up
vlanarg="vlan=$NICGUESS.$nicvlanid:$NICGUESS"
NICGUESS=$NICGUESS.$nicvlanid
fi
if [ "$autoconfigmethod" = "dhcp" ]; then
/usr/libexec/nm-initrd-generator ip=$NICGUESS:dhcp
/usr/libexec/nm-initrd-generator ip=$NICGUESS:dhcp $vlanarg
if [ -n "$vlanarg" ]; then
ip link del $NICGUESS
fi
else
v4addr=$(grep ^ipv4_address: $tcfg)
v4addr=${v4addr#ipv4_address: }
@@ -90,7 +104,7 @@ if [ -e /dev/disk/by-label/CNFLNT_IDNT ]; then
for dsrv in $deploysrvs; do
if curl --capath /tls/ -s --connect-timeout 3 https://$dsrv/confluent-public/ > /dev/null; then
rm /run/NetworkManager/system-connections/*
/usr/libexec/nm-initrd-generator ip=$v4addr::$v4gw:$v4nm:$hostname:$NICGUESS:none
/usr/libexec/nm-initrd-generator ip=$v4addr::$v4gw:$v4nm:$hostname:$NICGUESS:none $vlanarg
DETECTED=1
ifname=$NICGUESS
break
@@ -100,11 +114,17 @@ if [ -e /dev/disk/by-label/CNFLNT_IDNT ]; then
ip route del default via $v4gw
fi
ip addr flush dev $NICGUESS
if [ -n "$vlanarg" ]; then
ip link del $NICGUESS
fi
if [ $DETECTED = 1 ]; then
break
fi
fi
done
if [ "$DETECTED" = 0 ]; then
sleep 1
fi
done
for NICGUESS in $(ip link|grep LOWER_UP|grep -v LOOPBACK| awk '{print $2}' | sed -e 's/:$//'); do
ip addr flush dev $NICGUESS
@@ -261,6 +281,9 @@ kickstart=$proto://$mgr/confluent-public/os/$profilename/kickstart
export kickstart
autoconfigmethod=$(grep ipv4_method /etc/confluent/confluent.deploycfg)
autoconfigmethod=${autoconfigmethod#ipv4_method: }
if [ -n "$vlanarg" ]; then
echo $vlanarg >> /etc/cmdline.d/01-confluent.conf
fi
if [ "$autoconfigmethod" = "dhcp" ]; then
echo ip=$ifname:dhcp >> /etc/cmdline.d/01-confluent.conf
elif [ "$autoconfigmethod" = "static" ]; then
@@ -342,4 +365,6 @@ for NICGUESS in $(ip link|grep LOWER_UP|grep -v LOOPBACK| awk '{print $2}' | sed
ip addr flush dev $NICGUESS
ip link set $NICGUESS down
done
if [ -n "$vlanarg" ]; then
ip link del $ifname
fi