diff --git a/src/runtime-rs/crates/hypervisor/src/ch/inner_hypervisor.rs b/src/runtime-rs/crates/hypervisor/src/ch/inner_hypervisor.rs index 9cf5bcd8c8..a54a6a43e2 100644 --- a/src/runtime-rs/crates/hypervisor/src/ch/inner_hypervisor.rs +++ b/src/runtime-rs/crates/hypervisor/src/ch/inner_hypervisor.rs @@ -494,6 +494,10 @@ impl CloudHypervisorInner { Ok(()) } + pub(crate) async fn resize_vcpu(&self, old_vcpu: u32, new_vcpu: u32) -> Result<(u32, u32)> { + Ok((old_vcpu, new_vcpu)) + } + pub(crate) async fn get_pids(&self) -> Result> { Ok(Vec::::new()) } diff --git a/src/runtime-rs/crates/hypervisor/src/ch/mod.rs b/src/runtime-rs/crates/hypervisor/src/ch/mod.rs index a4b8b05fff..dd95413fc3 100644 --- a/src/runtime-rs/crates/hypervisor/src/ch/mod.rs +++ b/src/runtime-rs/crates/hypervisor/src/ch/mod.rs @@ -114,6 +114,11 @@ impl Hypervisor for CloudHypervisor { inner.cleanup().await } + async fn resize_vcpu(&self, old_vcpu: u32, new_vcpu: u32) -> Result<(u32, u32)> { + let inner = self.inner.read().await; + inner.resize_vcpu(old_vcpu, new_vcpu).await + } + async fn get_pids(&self) -> Result> { let inner = self.inner.read().await; inner.get_pids().await diff --git a/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs b/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs index beb99e1f37..09afc4c1a0 100644 --- a/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs +++ b/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs @@ -331,7 +331,7 @@ impl DragonballInner { // the error in this function is not ok to be tolerated, the container boot will fail fn precheck_resize_vcpus(&self, old_vcpus: u32, new_vcpus: u32) -> Result<(u32, u32)> { // old_vcpus > 0, safe for conversion - let current_vcpus = old_vcpus as u32; + let current_vcpus = old_vcpus; // a non-zero positive is required if new_vcpus == 0 { diff --git a/src/runtime-rs/crates/resource/src/cgroups/mod.rs b/src/runtime-rs/crates/resource/src/cgroups/mod.rs index d32fa479d3..831e30c0ff 100644 --- a/src/runtime-rs/crates/resource/src/cgroups/mod.rs +++ b/src/runtime-rs/crates/resource/src/cgroups/mod.rs @@ -173,7 +173,7 @@ impl CgroupsResource { } ResourceUpdateOp::Update | ResourceUpdateOp::Del => { if let Some(old_resource) = old_resources { - resources.insert(cid.to_owned(), old_resource.clone()); + resources.insert(cid.to_owned(), old_resource); } } }