mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
fix(host): virtio nic add fdb record on has sriov nic (#22285)
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/hostman/guestman/desc"
|
||||
"yunion.io/x/onecloud/pkg/hostman/options"
|
||||
"yunion.io/x/onecloud/pkg/util/iproute2"
|
||||
@@ -104,6 +105,11 @@ func (l *SLinuxBridgeDriver) getUpScripts(nic *desc.SGuestNetwork, isVolatileHos
|
||||
s += "ip address flush dev $1\n"
|
||||
s += "ip link set dev $1 up\n"
|
||||
s += "brctl addif ${switch} $1\n"
|
||||
if nic.Driver != compute.NETWORK_DRIVER_VFIO {
|
||||
if len(options.HostOptions.SRIOVNics) > 0 {
|
||||
s += fmt.Sprintf("bridge fdb add %s dev %s\n", nic.Mac, l.inter.String())
|
||||
}
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
@@ -117,6 +123,11 @@ func (l *SLinuxBridgeDriver) getDownScripts(nic *desc.SGuestNetwork, isVolatileH
|
||||
s += "ip addr flush dev $1\n"
|
||||
s += "ip link set dev $1 down\n"
|
||||
s += "brctl delif ${switch} $1\n"
|
||||
if nic.Driver != compute.NETWORK_DRIVER_VFIO {
|
||||
if len(options.HostOptions.SRIOVNics) > 0 {
|
||||
s += fmt.Sprintf("bridge fdb del %s dev %s\n", nic.Mac, l.inter.String())
|
||||
}
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -196,6 +196,9 @@ func (o *SOVSBridgeDriver) getUpScripts(nic *desc.SGuestNetwork, isVolatileHost
|
||||
s += " ovs-vsctl set Interface $IF ingress_policing_rate=$LIMIT\n"
|
||||
s += " ovs-vsctl set Interface $IF ingress_policing_burst=$BURST\n"
|
||||
s += "fi\n"
|
||||
if vpcProvider != compute.VPC_PROVIDER_OVN && len(options.HostOptions.SRIOVNics) > 0 {
|
||||
s += fmt.Sprintf("bridge fdb add %s dev %s\n", nic.Mac, o.inter.String())
|
||||
}
|
||||
}
|
||||
|
||||
s += "if [ $LIMIT_DOWNLOAD != \"0mbit\" ]; then\n"
|
||||
@@ -232,6 +235,11 @@ func (o *SOVSBridgeDriver) getDownScripts(nic *desc.SGuestNetwork, isVolatileHos
|
||||
s += "PORT=$(echo $PORT | awk 'BEGIN{FS=\"(\"}{print $1}')\n"
|
||||
s += "ip link set dev $IF down\n"
|
||||
s += "ovs-vsctl -- --if-exists del-port $SWITCH $IF\n"
|
||||
if nic.Driver != compute.NETWORK_DRIVER_VFIO {
|
||||
if nic.Vpc.Provider != compute.VPC_PROVIDER_OVN && len(options.HostOptions.SRIOVNics) > 0 {
|
||||
s += fmt.Sprintf("bridge fdb del %s dev %s\n", nic.Mac, o.inter.String())
|
||||
}
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user