mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-27 19:35:32 +00:00
gpu: Update the logging around CDI
Removed a rogue printf and updated the logging to say that we're waiting for CDI spec(s) to be generated rather than saying there is an error, it's not we have a timeout after that it is an error. Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This commit is contained in:
parent
2499d013bd
commit
908aacfa78
@ -271,7 +271,7 @@ pub async fn handle_cdi_devices(
|
||||
let options: Vec<CdiOption> = vec![with_auto_refresh(false), with_spec_dirs(&[spec_dir])];
|
||||
let cache: Arc<std::sync::Mutex<cdi::cache::Cache>> = new_cache(options);
|
||||
|
||||
for _ in 0..=cdi_timeout.as_secs() {
|
||||
for i in 0..=cdi_timeout.as_secs() {
|
||||
let inject_result = {
|
||||
// Lock cache within this scope, std::sync::Mutex has no Send
|
||||
// and await will not work with time::sleep
|
||||
@ -294,8 +294,13 @@ pub async fn handle_cdi_devices(
|
||||
return Ok(());
|
||||
}
|
||||
Err(e) => {
|
||||
info!(logger, "error injecting devices: {:?}", e);
|
||||
println!("error injecting devices: {:?}", e);
|
||||
info!(
|
||||
logger,
|
||||
"waiting for CDI spec(s) to be generated ({} of {} max tries) {:?}",
|
||||
i,
|
||||
cdi_timeout.as_secs(),
|
||||
e
|
||||
);
|
||||
}
|
||||
}
|
||||
time::sleep(Duration::from_secs(1)).await;
|
||||
@ -1245,8 +1250,13 @@ mod tests {
|
||||
|
||||
let cdi_timeout = Duration::from_secs(0);
|
||||
|
||||
let res =
|
||||
handle_cdi_devices(&logger, &mut spec, temp_dir.path().to_str().unwrap(), cdi_timeout).await;
|
||||
let res = handle_cdi_devices(
|
||||
&logger,
|
||||
&mut spec,
|
||||
temp_dir.path().to_str().unwrap(),
|
||||
cdi_timeout,
|
||||
)
|
||||
.await;
|
||||
println!("modfied spec {:?}", spec);
|
||||
assert!(res.is_ok(), "{}", res.err().unwrap());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user