runtime-rs: bugfix incorrect use of refcount before vfio attach

When there's a pod with multiple containers, there may be case that
attach point more than 2, we should not return Err in that case when
we are doing attach ops, but just return Ok.

Fixes: #8738

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
This commit is contained in:
alex.lyn 2024-01-08 15:30:48 +08:00 committed by Alex Lyn
parent aa9cd232cd
commit 548f252bc4

View File

@ -456,7 +456,13 @@ impl Device for VfioDevice {
.await
.context("failed to increase attach count")?
{
return Err(anyhow!("attach count increased failed as some reason."));
warn!(
sl!(),
"The device {:?} is not allowed to be attached more than one times.",
self.device_id
);
return Ok(());
}
// do add device for vfio deivce