Merge pull request #1384 from wanyaoqi/feature/wyq/live-migrate-filter-cpu-model

feature: live migrate filter cpu model
This commit is contained in:
yunion-ci-robot
2019-06-27 16:58:50 +08:00
committed by GitHub
19 changed files with 169 additions and 72 deletions
+10 -8
View File
@@ -31,14 +31,16 @@ const (
ErrNoEnoughAvailableGPUs = `no enough available GPUs`
ErrNotSupportNest = `nested function not supported`
ErrRequireMvs = `require mvs`
ErrRequireNoMvs = `require not mvs`
ErrHostIsSpecifiedForMigration = `host_id specified for migration`
ErrMoreThanOneSizeUnspecificSplit = `more than 1 size unspecific split`
ErrNoMoreSpaceForUnspecificSplit = `no more space for an unspecific split`
ErrSubtotalOfSplitExceedsDiskSize = `subtotal of split exceeds disk size`
ErrBaremetalHasAlreadyBeenOccupied = `baremetal has already been occupied`
ErrPrepaidHostOccupied = `prepaid host occupied`
ErrRequireMvs = `require mvs`
ErrRequireNoMvs = `require not mvs`
ErrHostIsSpecifiedForMigration = `host_id specified for migration`
ErrHostCpuModelIsNotMatchForLiveMigrate = `host cpu mode not match for live migrate`
ErrHostCpuMicrocodeNotMatchForLiveMigrate = `host cpu microcode 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`
ErrBaremetalHasAlreadyBeenOccupied = `baremetal has already been occupied`
ErrPrepaidHostOccupied = `prepaid host occupied`
ErrUnknown = `unknown error`
)
@@ -38,9 +38,23 @@ func (p *MigratePredicate) PreExecute(u *core.Unit, cs []core.Candidater) (bool,
func (p *MigratePredicate) Execute(u *core.Unit, c core.Candidater) (bool, []core.PredicateFailureReason, error) {
h := predicates.NewPredicateHelper(p, u, c)
schedData := u.SchedData()
if u.SchedData().HostId == c.IndexKey() {
if schedData.HostId == c.IndexKey() {
h.Exclude(predicates.ErrHostIsSpecifiedForMigration)
return h.GetResult()
}
if schedData.LiveMigrate {
host := c.Getter().Host()
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()
}
}
return h.GetResult()