support create arm virtual machine

This commit is contained in:
wanyaoqi
2020-08-24 17:22:40 +08:00
parent bb0d81bc06
commit 7d94c4e46f
21 changed files with 118 additions and 11 deletions

View File

@@ -41,6 +41,7 @@ const (
ErrSubtotalOfSplitExceedsDiskSize = `subtotal of split exceeds disk size`
ErrBaremetalHasAlreadyBeenOccupied = `baremetal has already been occupied`
ErrPrepaidHostOccupied = `prepaid host occupied`
ErrHostCpuArchitectureNotMatch = `host cpu architecture not match`
ErrUnknown = `unknown error`
)

View File

@@ -15,6 +15,7 @@
package guest
import (
"yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/scheduler/algorithm/predicates"
"yunion.io/x/onecloud/pkg/scheduler/core"
)
@@ -53,6 +54,13 @@ func (f *CPUPredicate) Execute(u *core.Unit, c core.Candidater) (bool, []core.Pr
useRsvd := h.UseReserved()
getter := c.Getter()
if d.OsArch == compute.CPU_ARCH_ARM {
host := getter.Host()
if !host.IsArmHost() {
h.Exclude(predicates.ErrHostCpuArchitectureNotMatch)
return h.GetResult()
}
}
freeCPUCount := getter.FreeCPUCount(useRsvd)
reqCPUCount := int64(d.Ncpu)
if freeCPUCount < reqCPUCount {