mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-15 13:58:55 +00:00
runtime-rs: Add Spec annotation to help pass image information
We need get the relevent image ref from OCI runtime Spec, especially the annotation of it. Fixes #10690 Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use agent::{Agent, Storage};
|
||||
@@ -100,10 +101,11 @@ impl ResourceManager {
|
||||
root: &oci::Root,
|
||||
bundle_path: &str,
|
||||
rootfs_mounts: &[Mount],
|
||||
annotations: &HashMap<String, String>,
|
||||
) -> Result<Arc<dyn Rootfs>> {
|
||||
let inner = self.inner.read().await;
|
||||
inner
|
||||
.handler_rootfs(cid, root, bundle_path, rootfs_mounts)
|
||||
.handler_rootfs(cid, root, bundle_path, rootfs_mounts, annotations)
|
||||
.await
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
use std::{sync::Arc, thread};
|
||||
use std::{collections::HashMap, sync::Arc, thread};
|
||||
|
||||
use agent::{types::Device, Agent, OnlineCPUMemRequest, Storage};
|
||||
use anyhow::{anyhow, Context, Ok, Result};
|
||||
@@ -320,6 +320,7 @@ impl ResourceManagerInner {
|
||||
root: &oci::Root,
|
||||
bundle_path: &str,
|
||||
rootfs_mounts: &[Mount],
|
||||
annotations: &HashMap<String, String>,
|
||||
) -> Result<Arc<dyn Rootfs>> {
|
||||
self.rootfs_resource
|
||||
.handler_rootfs(
|
||||
@@ -331,6 +332,7 @@ impl ResourceManagerInner {
|
||||
root,
|
||||
bundle_path,
|
||||
rootfs_mounts,
|
||||
annotations,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ mod block_rootfs;
|
||||
pub mod virtual_volume;
|
||||
use hypervisor::{device::device_manager::DeviceManager, Hypervisor};
|
||||
|
||||
use std::{sync::Arc, vec::Vec};
|
||||
use std::{collections::HashMap, sync::Arc, vec::Vec};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
use self::{block_rootfs::is_block_rootfs, nydus_rootfs::NYDUS_ROOTFS_TYPE};
|
||||
@@ -67,6 +67,7 @@ impl RootFsResource {
|
||||
root: &oci::Root,
|
||||
bundle_path: &str,
|
||||
rootfs_mounts: &[Mount],
|
||||
_annotations: &HashMap<String, String>,
|
||||
) -> Result<Arc<dyn Rootfs>> {
|
||||
match rootfs_mounts {
|
||||
// if rootfs_mounts is empty
|
||||
|
@@ -110,6 +110,8 @@ impl Container {
|
||||
// is 'true'.
|
||||
None => true,
|
||||
};
|
||||
let annotations = spec.annotations().clone().unwrap_or_default();
|
||||
|
||||
amend_spec(
|
||||
&mut spec,
|
||||
toml_config.runtime.disable_guest_seccomp,
|
||||
@@ -131,6 +133,7 @@ impl Container {
|
||||
root,
|
||||
&config.bundle,
|
||||
&config.rootfs_mounts,
|
||||
&annotations,
|
||||
)
|
||||
.await
|
||||
.context("handler rootfs")?;
|
||||
|
Reference in New Issue
Block a user