agent/device: update_spec_device_list() should error if dev not found

If update_spec_device_list() is given a device that can't be found in the
OCI spec, it currently does nothing, and returns Ok(()).  That doesn't
seem like what we'd expect and is not what the Go agent in Kata 1 does.

Change it to return an error in that case, like Kata 1.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2020-10-08 16:13:14 +11:00
parent 2e72972cd7
commit 08d80c1aaa

View File

@ -262,10 +262,14 @@ fn update_spec_device_list(device: &Device, spec: &mut Spec) -> Result<()> {
}
}
}
return Ok(());
}
}
Ok(())
Err(anyhow!(
"Should have found a matching device {} in the spec",
device.vm_path
))
}
// device.Id should be the predicted device name (vda, vdb, ...)