From 2c8045343c55bcf96ca05f7257f6cc838fe6bb51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Tue, 29 Mar 2022 21:24:32 +0200 Subject: [PATCH] vmm,cpu: Deny resizing only if the vcpu amount has changed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 188078467db42f50f5b7e7a7969738ebf8aec95c made clear that resize should only happen when dealing with a "dynamic" CpuManager. Although this is very much correct, it causes a regression on Kata Containers (and on any other consumer of Cloud Hypervisor) in cases where a resize would be triggered but the vCPUs values wouldn't be changed. There's no doubt Kata Containers could do better and do not call a resize in such situations, and that's something that should **also** be solved there. However, we should also work this around on Cloud Hypervisor side as it introduces a regression with the current Kata Containers code. Signed-off-by: Fabiano FidĂȘncio --- vmm/src/cpu.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index 7c1609870..44848ee93 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -1129,6 +1129,10 @@ impl CpuManager { } pub fn resize(&mut self, desired_vcpus: u8) -> Result { + if desired_vcpus.cmp(&self.present_vcpus()) == cmp::Ordering::Equal { + return Ok(false); + } + if !self.dynamic { return Err(Error::ResizingNotSupported); }