From 0fc7b4b74d1e1bfd598e5ebc05695a488ccd4ef3 Mon Sep 17 00:00:00 2001 From: stevenhorsman Date: Mon, 23 Jan 2023 16:02:50 +0000 Subject: [PATCH] agent: Improve logging of pull image - Add agent log if pull image fails Fixes: #6118 Signed-off-by: stevenhorsman --- src/agent/src/image_rpc.rs | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/agent/src/image_rpc.rs b/src/agent/src/image_rpc.rs index 0a66987cb2..0539ff0a41 100644 --- a/src/agent/src/image_rpc.rs +++ b/src/agent/src/image_rpc.rs @@ -295,16 +295,33 @@ impl ImageService { info!(sl!(), "pull image {:?}, bundle path {:?}", cid, bundle_path); // Image layers will store at KATA_CC_IMAGE_WORK_DIR, generated bundles // with rootfs and config.json will store under CONTAINER_BASE/cid. - self.image_client + let res = self + .image_client .lock() .await .pull_image(image, &bundle_path, &source_creds, &Some(&decrypt_config)) - .await?; + .await; - info!( - sl!(), - "pull and unpack image {:?}, with image-rs succeeded ", cid - ); + match res { + Ok(image) => { + info!( + sl!(), + "pull and unpack image {:?}, cid: {:?}, with image-rs succeed. ", + image, + cid + ); + } + Err(e) => { + error!( + sl!(), + "pull and unpack image {:?}, cid: {:?}, with image-rs failed with {:?}. ", + image, + cid, + e.to_string() + ); + return Err(e); + } + }; } let mut sandbox = self.sandbox.lock().await;