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 committed by Peng Tao
parent e97cd23bd6
commit 7cb650abcf

View File

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