fix(baremetal): only do status probe job when host_type is hypervisor

This commit is contained in:
Zexi Li
2023-02-15 12:52:35 +08:00
parent 695fd2690a
commit bc23199951
+4 -1
View File
@@ -530,10 +530,13 @@ func newBaremetalInstance(man *SBaremetalManager, desc jsonutils.JSONObject) (*S
serverLock: new(sync.Mutex),
}
bm.cronJobs = []IBaremetalCronJob{
NewStatusProbeJob(bm, time.Duration(o.Options.StatusProbeIntervalSeconds)*time.Second),
NewLogFetchJob(bm, time.Duration(o.Options.LogFetchIntervalSeconds)*time.Second),
NewSendMetricsJob(bm, time.Duration(o.Options.SendMetricsIntervalSeconds)*time.Second),
}
hostType, _ := bm.desc.GetString("host_type")
if !utils.IsInStringArray(hostType, []string{api.HOST_TYPE_KVM, api.HOST_TYPE_HYPERVISOR}) {
bm.cronJobs = append(bm.cronJobs, NewStatusProbeJob(bm, time.Duration(o.Options.StatusProbeIntervalSeconds)*time.Second))
}
err := os.MkdirAll(bm.GetDir(), 0755)
if err != nil {
return nil, err