vmm,cpu: Deny resizing only if the vcpu amount has changed

188078467d 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 <fabiano.fidencio@intel.com>
This commit is contained in:
Fabiano Fidêncio 2022-03-29 21:24:32 +02:00 committed by Rob Bradford
parent db06c31305
commit 2c8045343c

View File

@ -1129,6 +1129,10 @@ impl CpuManager {
}
pub fn resize(&mut self, desired_vcpus: u8) -> Result<bool> {
if desired_vcpus.cmp(&self.present_vcpus()) == cmp::Ordering::Equal {
return Ok(false);
}
if !self.dynamic {
return Err(Error::ResizingNotSupported);
}