mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 20:54:26 +00:00
agent/uevent: Improve logging of wait_for_uevent()
These messages will help when debugging matchers not matching properly. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
cf36fd87ad
commit
5b1eb08bde
@ -111,10 +111,13 @@ pub async fn wait_for_uevent(
|
|||||||
sandbox: &Arc<Mutex<Sandbox>>,
|
sandbox: &Arc<Mutex<Sandbox>>,
|
||||||
matcher: impl UeventMatcher,
|
matcher: impl UeventMatcher,
|
||||||
) -> Result<Uevent> {
|
) -> Result<Uevent> {
|
||||||
|
let logprefix = format!("Waiting for {:?}", &matcher);
|
||||||
|
|
||||||
|
info!(sl!(), "{}", logprefix);
|
||||||
let mut sb = sandbox.lock().await;
|
let mut sb = sandbox.lock().await;
|
||||||
for uev in sb.uevent_map.values() {
|
for uev in sb.uevent_map.values() {
|
||||||
if matcher.is_match(uev) {
|
if matcher.is_match(uev) {
|
||||||
info!(sl!(), "Device {:?} found in device map", uev);
|
info!(sl!(), "{}: found {:?} in uevent map", logprefix, &uev);
|
||||||
return Ok(uev.clone());
|
return Ok(uev.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,7 +132,8 @@ pub async fn wait_for_uevent(
|
|||||||
sb.uevent_watchers.push(Some((Box::new(matcher), tx)));
|
sb.uevent_watchers.push(Some((Box::new(matcher), tx)));
|
||||||
drop(sb); // unlock
|
drop(sb); // unlock
|
||||||
|
|
||||||
info!(sl!(), "Waiting on channel for uevent notification\n");
|
info!(sl!(), "{}: waiting on channel", logprefix);
|
||||||
|
|
||||||
let hotplug_timeout = AGENT_CONFIG.read().await.hotplug_timeout;
|
let hotplug_timeout = AGENT_CONFIG.read().await.hotplug_timeout;
|
||||||
|
|
||||||
let uev = match tokio::time::timeout(hotplug_timeout, rx).await {
|
let uev = match tokio::time::timeout(hotplug_timeout, rx).await {
|
||||||
@ -146,6 +150,7 @@ pub async fn wait_for_uevent(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
info!(sl!(), "{}: found {:?} on channel", logprefix, &uev);
|
||||||
Ok(uev)
|
Ok(uev)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user