runtime-rs: call network.remove() during resource cleanup

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 <ffidencio@nvidia.com>
Assisted-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Fabiano Fidêncio
2026-05-27 21:15:56 +02:00
parent 0b4b51dff6
commit 60f2878c68

View File

@@ -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()