From 96e9374d4b778f7fb542b50165d8e4a9165e3f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Sat, 8 Jul 2023 14:55:16 +0200 Subject: [PATCH] dragonball: Don't fail if a request asks for more CPUs than allowed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's take the same approach of the go runtime, instead, and allocate the maximum allowed number of vcpus instead. Fixes: #7270 Signed-off-by: Fabiano FidĂȘncio --- src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs b/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs index c7c9cb082a..91f9406b88 100644 --- a/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs +++ b/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs @@ -341,7 +341,10 @@ impl DragonballInner { // cannot exceed maximum value if new_vcpus > self.config.cpu_info.default_maxvcpus { - return Err(anyhow!("resize vcpu error: cannot greater than maxvcpus")); + warn!( + sl!(), + "Cannot allocate more vcpus than the max allowed number of vcpus. The maximum allowed amount of vcpus will be used instead."); + return Ok((current_vcpus, self.config.cpu_info.default_maxvcpus)); } Ok((current_vcpus, new_vcpus))