From 076b6e5387d4e665b1ec536694e97104f5f753b6 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Tue, 3 Jan 2023 18:14:51 +0800 Subject: [PATCH] fix(scheduler): do migrate checking when hypervisor is not esxi --- .../predicates/guest/migrate_predicate.go | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/pkg/scheduler/algorithm/predicates/guest/migrate_predicate.go b/pkg/scheduler/algorithm/predicates/guest/migrate_predicate.go index ffb03545e9..66274f080b 100644 --- a/pkg/scheduler/algorithm/predicates/guest/migrate_predicate.go +++ b/pkg/scheduler/algorithm/predicates/guest/migrate_predicate.go @@ -52,30 +52,33 @@ func (p *MigratePredicate) Execute(ctx context.Context, u *core.Unit, c core.Can if schedData.LiveMigrate { host := c.Getter().Host() - // target host mem page size check - if schedData.HostMemPageSizeKB != host.PageSizeKB { - h.Exclude(predicates.ErrHostMemPageSizeNotMatchForLiveMigrate) - return h.GetResult() - } - - // target host cpu check - if schedData.CpuMode != compute.CPU_MODE_QEMU && (schedData.SkipCpuCheck == nil || *schedData.SkipCpuCheck == false) { - if schedData.CpuDesc != host.CpuDesc { - h.Exclude(predicates.ErrHostCpuModelIsNotMatchForLiveMigrate) + guestHypervisor := u.SchedData().Hypervisor + if guestHypervisor != compute.HYPERVISOR_ESXI { + // target host mem page size check + if schedData.HostMemPageSizeKB != host.PageSizeKB { + h.Exclude(predicates.ErrHostMemPageSizeNotMatchForLiveMigrate) return h.GetResult() } - if len(schedData.CpuMicrocode) > 0 && schedData.CpuMicrocode != host.CpuMicrocode { - h.Exclude(predicates.ErrHostCpuMicrocodeNotMatchForLiveMigrate) - return h.GetResult() - } - } - // target host kernel check - if schedData.SkipKernelCheck != nil && !*schedData.SkipKernelCheck { - kv, _ := host.SysInfo.GetString("kernel_version") - if schedData.TargetHostKernel != "" && schedData.TargetHostKernel != kv { - h.Exclude2(predicates.ErrHostKernelNotMatchForLiveMigrate, kv, schedData.TargetHostKernel) - return h.GetResult() + // target host cpu check + if schedData.CpuMode != compute.CPU_MODE_QEMU && (schedData.SkipCpuCheck == nil || *schedData.SkipCpuCheck == false) { + if schedData.CpuDesc != host.CpuDesc { + h.Exclude(predicates.ErrHostCpuModelIsNotMatchForLiveMigrate) + return h.GetResult() + } + if len(schedData.CpuMicrocode) > 0 && schedData.CpuMicrocode != host.CpuMicrocode { + h.Exclude(predicates.ErrHostCpuMicrocodeNotMatchForLiveMigrate) + return h.GetResult() + } + } + + // target host kernel check + if schedData.SkipKernelCheck != nil && !*schedData.SkipKernelCheck { + kv, _ := host.SysInfo.GetString("kernel_version") + if schedData.TargetHostKernel != "" && schedData.TargetHostKernel != kv { + h.Exclude2(predicates.ErrHostKernelNotMatchForLiveMigrate, kv, schedData.TargetHostKernel) + return h.GetResult() + } } } }