mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-19 15:58:25 +00:00
agent: Update logger
`sl` was switched from a macro to a function, so update the CoCo specifics uses of it Signed-off-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
@@ -38,11 +38,9 @@ const KATA_CC_IMAGE_WORK_DIR: &str = "/run/image/";
|
|||||||
const KATA_CC_PAUSE_BUNDLE: &str = "/pause_bundle";
|
const KATA_CC_PAUSE_BUNDLE: &str = "/pause_bundle";
|
||||||
const CONFIG_JSON: &str = "config.json";
|
const CONFIG_JSON: &str = "config.json";
|
||||||
|
|
||||||
// Convenience macro to obtain the scope logger
|
// Convenience function to obtain the scope logger.
|
||||||
macro_rules! sl {
|
fn sl() -> slog::Logger {
|
||||||
() => {
|
slog_scope::logger().new(o!("subsystem" => "cgroups"))
|
||||||
slog_scope::logger()
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ImageService {
|
pub struct ImageService {
|
||||||
@@ -87,7 +85,7 @@ impl ImageService {
|
|||||||
return Err(anyhow!("Pause image not present in rootfs"));
|
return Err(anyhow!("Pause image not present in rootfs"));
|
||||||
}
|
}
|
||||||
|
|
||||||
info!(sl!(), "use guest pause image cid {:?}", cid);
|
info!(sl(), "use guest pause image cid {:?}", cid);
|
||||||
let pause_bundle = Path::new(CONTAINER_BASE).join(cid);
|
let pause_bundle = Path::new(CONTAINER_BASE).join(cid);
|
||||||
let pause_rootfs = pause_bundle.join("rootfs");
|
let pause_rootfs = pause_bundle.join("rootfs");
|
||||||
let pause_config = pause_bundle.join(CONFIG_JSON);
|
let pause_config = pause_bundle.join(CONFIG_JSON);
|
||||||
@@ -187,12 +185,12 @@ impl ImageService {
|
|||||||
Ordering::SeqCst,
|
Ordering::SeqCst,
|
||||||
) {
|
) {
|
||||||
Ok(_) => Self::init_attestation_agent()?,
|
Ok(_) => Self::init_attestation_agent()?,
|
||||||
Err(_) => info!(sl!(), "Attestation Agent already running"),
|
Err(_) => info!(sl(), "Attestation Agent already running"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If the attestation-agent is being used, then enable the authenticated credentials support
|
// If the attestation-agent is being used, then enable the authenticated credentials support
|
||||||
info!(
|
info!(
|
||||||
sl!(),
|
sl(),
|
||||||
"image_client.config.auth set to: {}",
|
"image_client.config.auth set to: {}",
|
||||||
!aa_kbc_params.is_empty()
|
!aa_kbc_params.is_empty()
|
||||||
);
|
);
|
||||||
@@ -201,7 +199,7 @@ impl ImageService {
|
|||||||
// Read enable signature verification from the agent config and set it in the image_client
|
// Read enable signature verification from the agent config and set it in the image_client
|
||||||
let enable_signature_verification = &AGENT_CONFIG.enable_signature_verification;
|
let enable_signature_verification = &AGENT_CONFIG.enable_signature_verification;
|
||||||
info!(
|
info!(
|
||||||
sl!(),
|
sl(),
|
||||||
"enable_signature_verification set to: {}", enable_signature_verification
|
"enable_signature_verification set to: {}", enable_signature_verification
|
||||||
);
|
);
|
||||||
self.image_client.lock().await.config.security_validate = *enable_signature_verification;
|
self.image_client.lock().await.config.security_validate = *enable_signature_verification;
|
||||||
@@ -213,7 +211,7 @@ impl ImageService {
|
|||||||
|
|
||||||
let decrypt_config = format!("provider:attestation-agent:{}", aa_kbc_params);
|
let decrypt_config = format!("provider:attestation-agent:{}", aa_kbc_params);
|
||||||
|
|
||||||
info!(sl!(), "pull image {:?}, bundle path {:?}", cid, bundle_path);
|
info!(sl(), "pull image {:?}, bundle path {:?}", cid, bundle_path);
|
||||||
// Image layers will store at KATA_CC_IMAGE_WORK_DIR, generated bundles
|
// Image layers will store at KATA_CC_IMAGE_WORK_DIR, generated bundles
|
||||||
// with rootfs and config.json will store under CONTAINER_BASE/cid.
|
// with rootfs and config.json will store under CONTAINER_BASE/cid.
|
||||||
let res = self
|
let res = self
|
||||||
@@ -226,13 +224,13 @@ impl ImageService {
|
|||||||
match res {
|
match res {
|
||||||
Ok(image) => {
|
Ok(image) => {
|
||||||
info!(
|
info!(
|
||||||
sl!(),
|
sl(),
|
||||||
"pull and unpack image {:?}, cid: {:?}, with image-rs succeed. ", image, cid
|
"pull and unpack image {:?}, cid: {:?}, with image-rs succeed. ", image, cid
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!(
|
error!(
|
||||||
sl!(),
|
sl(),
|
||||||
"pull and unpack image {:?}, cid: {:?}, with image-rs failed with {:?}. ",
|
"pull and unpack image {:?}, cid: {:?}, with image-rs failed with {:?}. ",
|
||||||
image,
|
image,
|
||||||
cid,
|
cid,
|
||||||
|
@@ -231,7 +231,7 @@ impl AgentService {
|
|||||||
if specdev.path == TRUSTED_STORAGE_DEVICE {
|
if specdev.path == TRUSTED_STORAGE_DEVICE {
|
||||||
let data_integrity = AGENT_CONFIG.data_integrity;
|
let data_integrity = AGENT_CONFIG.data_integrity;
|
||||||
info!(
|
info!(
|
||||||
sl!(),
|
sl(),
|
||||||
"trusted_store device major:min {}, enable data integrity {}",
|
"trusted_store device major:min {}, enable data integrity {}",
|
||||||
dev_major_minor,
|
dev_major_minor,
|
||||||
data_integrity.to_string()
|
data_integrity.to_string()
|
||||||
@@ -718,7 +718,7 @@ impl AgentService {
|
|||||||
.join(container_id)
|
.join(container_id)
|
||||||
.join(CONFIG_JSON);
|
.join(CONFIG_JSON);
|
||||||
debug!(
|
debug!(
|
||||||
sl!(),
|
sl(),
|
||||||
"Image bundle config path: {:?}", image_oci_config_path
|
"Image bundle config path: {:?}", image_oci_config_path
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user