diff --git a/pkg/hostman/hostinfo/hostbridge/hostbridge.go b/pkg/hostman/hostinfo/hostbridge/hostbridge.go index 194dd92d59..068f9ad93b 100644 --- a/pkg/hostman/hostinfo/hostbridge/hostbridge.go +++ b/pkg/hostman/hostinfo/hostbridge/hostbridge.go @@ -80,7 +80,25 @@ func NewBaseBridgeDriver(bridge, inter, ip string) (*SBaseBridgeDriver, error) { return nil, fmt.Errorf("%s not exists", inter) } bd.ip = ip - bd.inter.SetupGso(options.HostOptions.EthtoolEnableGso) + var enableGso bool + if len(options.HostOptions.EthtoolEnableGsoInterfaces) > 0 { + if utils.IsInStringArray(bridge, options.HostOptions.EthtoolEnableGsoInterfaces) || + utils.IsInStringArray(inter, options.HostOptions.EthtoolEnableGsoInterfaces) { + enableGso = true + } else { + enableGso = false + } + } else if len(options.HostOptions.EthtoolDisableGsoInterfaces) > 0 { + if utils.IsInStringArray(bridge, options.HostOptions.EthtoolDisableGsoInterfaces) || + utils.IsInStringArray(inter, options.HostOptions.EthtoolDisableGsoInterfaces) { + enableGso = false + } else { + enableGso = true + } + } else { + enableGso = options.HostOptions.EthtoolEnableGso + } + bd.inter.SetupGso(enableGso) } else if len(ip) > 0 { return nil, fmt.Errorf("A bridge without interface must have no IP") } diff --git a/pkg/hostman/hostinfo/hostinfo.go b/pkg/hostman/hostinfo/hostinfo.go index 2de02bf663..160ea8ebb6 100644 --- a/pkg/hostman/hostinfo/hostinfo.go +++ b/pkg/hostman/hostinfo/hostinfo.go @@ -1621,10 +1621,9 @@ func (h *SHostInfo) doSyncNicInfo(nic *SNIC) error { content := jsonutils.NewDict() content.Set("bridge", jsonutils.NewString(nic.Bridge)) content.Set("interface", jsonutils.NewString(nic.Inter)) - query := jsonutils.NewDict() - query.Set("mac_addr", jsonutils.NewString(nic.BridgeDev.GetMac())) + content.Set("mac_addr", jsonutils.NewString(nic.BridgeDev.GetMac())) _, err := modules.Hostwires.Update(h.GetSession(), - h.HostId, nic.WireId, query, content) + h.HostId, nic.WireId, nil, content) if err != nil { return errors.Wrap(err, "modules.Hostwires.Update") } @@ -2137,6 +2136,7 @@ func (h *SHostInfo) OnCatalogChanged(catalog mcclient.KeystoneServiceCatalogV3) func (h *SHostInfo) getNicsTelegrafConf() []map[string]interface{} { var ret = make([]map[string]interface{}, 0) + existing := make(map[string]struct{}) for i, n := range h.Nics { ret = append(ret, map[string]interface{}{ "name": n.Inter, @@ -2148,6 +2148,16 @@ func (h *SHostInfo) getNicsTelegrafConf() []map[string]interface{} { "alias": fmt.Sprintf("br%d", i), "speed": n.Bandwidth, }) + existing[n.Inter] = struct{}{} + } + phyNics, _ := sysutils.Nics() + for _, pnic := range phyNics { + if _, ok := existing[pnic.Dev]; !ok { + ret = append(ret, map[string]interface{}{ + "name": pnic.Dev, + "speed": pnic.Speed, + }) + } } return ret } diff --git a/pkg/hostman/options/options.go b/pkg/hostman/options/options.go index affcde1973..b56883b4a7 100644 --- a/pkg/hostman/options/options.go +++ b/pkg/hostman/options/options.go @@ -175,6 +175,9 @@ type SHostOptions struct { EthtoolEnableGso bool `help:"use ethtool to turn on or off GSO(generic segment offloading)" default:"false" json:"ethtool_enable_gso"` + EthtoolEnableGsoInterfaces []string `help:"use ethtool to turn on GSO for the specific interfaces" json:"ethtool_enable_gso_interfaces"` + EthtoolDisableGsoInterfaces []string `help:"use ethtool to turn off GSO for the specific interfaces" json:"ethtool_disable_gso_interfaces"` + EnableVmUuid bool `help:"enable vm UUID" default:"true" json:"enable_vm_uuid"` EnableVirtioRngDevice bool `help:"enable qemu virtio-rng device" default:"true"`