From 60f2878c68db90b780fdf6e65d2edfe62bf50b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Wed, 27 May 2026 21:15:56 +0200 Subject: [PATCH] runtime-rs: call network.remove() during resource cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit network.remove() — which detaches endpoints and rebinds VFs from vfio-pci back to the host driver — was never being called. ResourceManagerInner::cleanup() handled cgroups, bindmounts, share-fs, swap and ephemeral disks, but completely omitted the network teardown. Call network.remove() at the start of cleanup(), using the already-held self.hypervisor reference. Errors are logged as warnings rather than propagated, so they don't block the rest of the cleanup sequence. Signed-off-by: Fabiano Fidêncio Assisted-by: Cursor --- src/runtime-rs/crates/resource/src/manager_inner.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/runtime-rs/crates/resource/src/manager_inner.rs b/src/runtime-rs/crates/resource/src/manager_inner.rs index 2d2aedcc81..2890ea3af0 100644 --- a/src/runtime-rs/crates/resource/src/manager_inner.rs +++ b/src/runtime-rs/crates/resource/src/manager_inner.rs @@ -731,6 +731,13 @@ impl ResourceManagerInner { } pub async fn cleanup(&self) -> Result<()> { + // detach network endpoints (rebinds VFs from vfio-pci back to host driver) + if let Some(network) = &self.network { + if let Err(err) = network.remove(self.hypervisor.as_ref()).await { + warn!(sl!(), "failed to remove network: {}", err); + } + } + // clean up cgroup self.cgroups_resource .delete()