fix(host): support skip check kernel mod (#24217)

This commit is contained in:
屈轩
2026-02-04 10:29:54 +08:00
committed by GitHub
parent ecc9ba0d86
commit 3e5d16875d
3 changed files with 13 additions and 6 deletions

View File

@@ -284,9 +284,11 @@ func OVSPrepare() error {
ovs := system_service.GetService("openvswitch")
if !ovs.IsInstalled() || !ovs.IsActive() {
// no openvswitch service found, first try load openvswitch kernel modules, then try ovs-vsctl command, if success, return nil
err := procutils.NewRemoteCommandAsFarAsPossible("modprobe", "openvswitch").Run()
if err != nil {
return errors.Wrap(err, "Failed to load openvswitch kernel modules")
if !utils.IsInStringArray("openvswitch", options.HostOptions.SkipCheckKernelMods) {
err := procutils.NewRemoteCommandAsFarAsPossible("modprobe", "openvswitch").Run()
if err != nil {
return errors.Wrap(err, "Failed to load openvswitch kernel modules")
}
}
// wait for the ovs-vswitchd to start
startProbe := time.Now()

View File

@@ -517,10 +517,13 @@ func (h *SHostInfo) prepareEnv() error {
fileutils2.ChangeSsdBlkdevsParams(ioParams)
}
_, err = procutils.NewRemoteCommandAsFarAsPossible("modprobe", "tun").Output()
if err != nil {
return errors.Wrap(err, "Failed to activate tun/tap device")
if !utils.IsInStringArray("tun", options.HostOptions.SkipCheckKernelMods) {
_, err = procutils.NewRemoteCommandAsFarAsPossible("modprobe", "tun").Output()
if err != nil {
return errors.Wrap(err, "Failed to activate tun/tap device")
}
}
output, err := procutils.NewRemoteCommandAsFarAsPossible("modprobe", "vhost_net").Output()
if err != nil {
log.Warningf("modprobe vhost_net error: %s", output)

View File

@@ -259,6 +259,8 @@ type SHostOptions struct {
CudaMPSLogDirectory string `help:"cuda mps log dir" default:"/tmp/nvidia-mps/log"`
CudaMPSReplicas int `help:"cuda mps replicas" default:"10"`
SkipCheckKernelMods []string `help:"skip check kernel modules"`
EnableContainerAscendNPU bool `help:"enable container npu" default:"false"`
EnableDirtyRecoverySeconds int `help:"Seconds to delay enable dirty guests recovery feature, default 15 minutes" default:"900"`