mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(scheduler): do migrate checking when hypervisor is not esxi
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user