Merge pull request #15168 from wanyaoqi/fix/hugepages

feat(region,host): hugepage optimize
This commit is contained in:
Zexi Li
2022-10-13 09:47:18 +08:00
committed by GitHub
10 changed files with 49 additions and 71 deletions
@@ -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`
ErrHostMemPageSizeNotMatchForLiveMigrate = `host mem page size 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`
@@ -51,6 +51,13 @@ func (p *MigratePredicate) Execute(ctx context.Context, u *core.Unit, c core.Can
// live migrate check
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 {
@@ -67,7 +74,7 @@ func (p *MigratePredicate) Execute(ctx context.Context, u *core.Unit, c core.Can
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)
h.Exclude2(predicates.ErrHostKernelNotMatchForLiveMigrate, kv, schedData.TargetHostKernel)
return h.GetResult()
}
}