runtime: DefaultMaxVCPUs should not greater than defaultMaxQemuVCPUs

DefaultMaxVCPUs may be larger than the defaultMaxQemuVCPUs that should
be checked and avoided.

Fixes: #2809
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
This commit is contained in:
Jianyong Wu 2021-10-15 13:33:19 +08:00
parent c59c36732b
commit 43b13a4a6d

View File

@ -567,7 +567,7 @@ func (conf *HypervisorConfig) valid() error {
conf.BlockDeviceDriver = config.VirtioBlockCCW
}
if conf.DefaultMaxVCPUs == 0 {
if conf.DefaultMaxVCPUs == 0 || conf.DefaultMaxVCPUs > defaultMaxQemuVCPUs {
conf.DefaultMaxVCPUs = defaultMaxQemuVCPUs
}