mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #13125 from zexi/migrate-kernel-check
fix(region,scheduler): live migrate target host kernel version check
This commit is contained in:
@@ -36,6 +36,7 @@ const (
|
||||
ErrHostIsSpecifiedForMigration = `host_id specified for migration`
|
||||
ErrHostCpuModelIsNotMatchForLiveMigrate = `host cpu mode not match for live migrate`
|
||||
ErrHostCpuMicrocodeNotMatchForLiveMigrate = `host cpu microcode not match for live migrate`
|
||||
ErrHostKernelNotMatchForLiveMigrate = `host kernel not match for live migrate`
|
||||
ErrMoreThanOneSizeUnspecificSplit = `more than 1 size unspecific split`
|
||||
ErrNoMoreSpaceForUnspecificSplit = `no more space for an unspecific split`
|
||||
ErrSubtotalOfSplitExceedsDiskSize = `subtotal of split exceeds disk size`
|
||||
|
||||
@@ -46,17 +46,29 @@ func (p *MigratePredicate) Execute(u *core.Unit, c core.Candidater) (bool, []cor
|
||||
return h.GetResult()
|
||||
}
|
||||
|
||||
if schedData.LiveMigrate && schedData.CpuMode != compute.CPU_MODE_QEMU && (schedData.SkipCpuCheck == nil || *schedData.SkipCpuCheck == false) {
|
||||
// live migrate check
|
||||
if schedData.LiveMigrate {
|
||||
host := c.Getter().Host()
|
||||
if schedData.CpuDesc != host.CpuDesc {
|
||||
h.Exclude(predicates.ErrHostCpuModelIsNotMatchForLiveMigrate)
|
||||
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()
|
||||
}
|
||||
}
|
||||
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.ErrHostCpuMicrocodeNotMatchForLiveMigrate, kv, schedData.TargetHostKernel)
|
||||
return h.GetResult()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return h.GetResult()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user