fix(host-deployer): bond netplan add vlan subinterface config (#25177)

This commit is contained in:
wanyaoqi
2026-07-20 12:16:07 +08:00
committed by GitHub
parent af1c3e03a6
commit 31f19deb84
+21 -6
View File
@@ -86,17 +86,32 @@ func newNetplanNetwork(allNics []*types.SServerNic, bondNics []*types.SServerNic
network.AddEthernet(sn.Name, nicConf)
}
netConf := getNetplanEthernetConfig(bondNic, true, mainIp, mainIp6, nicCnt)
if netConf.Mtu == 0 {
netConf.Mtu = defaultMtu
}
if bondNic.VlanInterface {
ifname := fmt.Sprintf("%s.%d", bondNic.Name, bondNic.Vlan)
vlanConfig := &netplan.VlanConfig{
EthernetConfig: *netConf,
Link: bondNic.Name,
Id: bondNic.Vlan,
}
network.AddVlan(ifname, vlanConfig)
// TODO: implement kinds of bond mode config
bondConf := netplan.NewBondMode4(netConf, interfaces)
network.AddBond(bondNic.Name, bondConf)
bondNicConf := &netplan.EthernetConfig{
DHCP4: false,
DHCP6: false,
MacAddress: bondNic.Mac,
Match: netplan.NewEthernetConfigMatchMac(bondNic.Mac),
}
bondConf := netplan.NewBondMode4(bondNicConf, interfaces)
network.AddBond(bondNic.Name, bondConf)
} else {
// TODO: implement kinds of bond mode config
bondConf := netplan.NewBondMode4(netConf, interfaces)
network.AddBond(bondNic.Name, bondConf)
}
}
return network