agent: Introduce ImageService

Introduce structure ImageService, which will be used to pull images
inside the guest.

Fixes: #8103

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
co-authored-by: wllenyj <wllenyj@linux.alibaba.com>
co-authored-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
ChengyuZhu6 2023-11-21 21:52:01 +08:00 committed by Fabiano Fidêncio
parent 42dfe0e8d1
commit 1f1ca6187d
No known key found for this signature in database
GPG Key ID: EE926C2BDACC177B
3 changed files with 26 additions and 0 deletions

24
src/agent/src/image.rs Normal file
View File

@ -0,0 +1,24 @@
// Copyright (c) 2021 Alibaba Cloud
// Copyright (c) 2021, 2023 IBM Corporation
// Copyright (c) 2022 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
use std::sync::Arc;
use tokio::sync::Mutex;
use crate::sandbox::Sandbox;
// Convenience function to obtain the scope logger.
fn sl() -> slog::Logger {
slog_scope::logger().new(o!("subsystem" => "image"))
}
pub struct ImageService {
sandbox: Arc<Mutex<Sandbox>>,
}
impl ImageService {
pub fn new(sandbox: Arc<Mutex<Sandbox>>) -> Self {
Self { sandbox }
}
}

View File

@ -73,6 +73,7 @@ use tokio::{
task::JoinHandle,
};
mod image;
mod rpc;
mod tracer;

View File

@ -54,6 +54,7 @@ use rustjail::process::ProcessOperations;
use crate::device::{add_devices, get_virtio_blk_pci_device_name, update_env_pci};
use crate::features::get_build_features;
use crate::image;
use crate::linux_abi::*;
use crate::metrics::get_metrics;
use crate::mount::baremount;