mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-25 06:52:13 +00:00
agent/device: Check for conflicting device updates
For each device in the OCI spec we need to update it to reflect the guest rather than the host. We do this with additional device information provided by the runtime. There should only be one update for each device though, if there are multiple, something has gone horribly wrong. Detect and report this situation, for safety. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
f10e8c8165
commit
f4982130e1
@ -745,7 +745,15 @@ pub async fn add_devices(
|
||||
for device in devices.iter() {
|
||||
let update = add_device(device, sandbox).await?;
|
||||
if let Some(dev_update) = update.dev {
|
||||
dev_updates.insert(&device.container_path, dev_update);
|
||||
if dev_updates
|
||||
.insert(&device.container_path, dev_update)
|
||||
.is_some()
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"Conflicting device updates for {}",
|
||||
&device.container_path
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user