mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-01 08:56:32 +00:00
runtime-rs: Import the public const value from libs
Introduce a const value `KATA_VIRTUAL_VOLUME_PREFIX` defined in the libs/kata-types, and it'll be better import such const value from there. Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
@@ -47,6 +47,9 @@ pub const SANDBOX_BIND_MOUNTS_RO: &str = ":ro";
|
|||||||
/// SANDBOX_BIND_MOUNTS_RO is for sandbox bindmounts with readwrite
|
/// SANDBOX_BIND_MOUNTS_RO is for sandbox bindmounts with readwrite
|
||||||
pub const SANDBOX_BIND_MOUNTS_RW: &str = ":rw";
|
pub const SANDBOX_BIND_MOUNTS_RW: &str = ":rw";
|
||||||
|
|
||||||
|
/// KATA_VIRTUAL_VOLUME_PREFIX is for container image guest pull
|
||||||
|
pub const KATA_VIRTUAL_VOLUME_PREFIX: &str = "io.katacontainers.volume=";
|
||||||
|
|
||||||
/// Directly assign a block volume to vm and mount it inside guest.
|
/// Directly assign a block volume to vm and mount it inside guest.
|
||||||
pub const KATA_VIRTUAL_VOLUME_DIRECT_BLOCK: &str = "direct_block";
|
pub const KATA_VIRTUAL_VOLUME_DIRECT_BLOCK: &str = "direct_block";
|
||||||
/// Present a container image as a generic block device.
|
/// Present a container image as a generic block device.
|
||||||
@@ -532,7 +535,7 @@ pub fn adjust_rootfs_mounts() -> Result<Vec<Mount>> {
|
|||||||
// Create a new Vec<Mount> with a single Mount entry.
|
// Create a new Vec<Mount> with a single Mount entry.
|
||||||
// This Mount's options will contain the base64-encoded virtual volume.
|
// This Mount's options will contain the base64-encoded virtual volume.
|
||||||
Ok(vec![Mount {
|
Ok(vec![Mount {
|
||||||
options: vec![format!("{}={}", "io.katacontainers.volume", b64_vol)],
|
options: vec![format!("{}{}", KATA_VIRTUAL_VOLUME_PREFIX, b64_vol)],
|
||||||
..Default::default() // Use default values for other Mount fields
|
..Default::default() // Use default values for other Mount fields
|
||||||
}])
|
}])
|
||||||
}
|
}
|
||||||
|
@@ -17,13 +17,12 @@ use hypervisor::device::device_manager::DeviceManager;
|
|||||||
use kata_types::{
|
use kata_types::{
|
||||||
annotations,
|
annotations,
|
||||||
container::ContainerType,
|
container::ContainerType,
|
||||||
mount::{KataVirtualVolume, KATA_VIRTUAL_VOLUME_IMAGE_GUEST_PULL},
|
mount::{KataVirtualVolume, KATA_VIRTUAL_VOLUME_IMAGE_GUEST_PULL, KATA_VIRTUAL_VOLUME_PREFIX},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Image guest-pull related consts
|
/// Image guest-pull related consts
|
||||||
const KUBERNETES_CRI_IMAGE_NAME: &str = "io.kubernetes.cri.image-name";
|
const KUBERNETES_CRI_IMAGE_NAME: &str = "io.kubernetes.cri.image-name";
|
||||||
const KUBERNETES_CRIO_IMAGE_NAME: &str = "io.kubernetes.cri-o.ImageName";
|
const KUBERNETES_CRIO_IMAGE_NAME: &str = "io.kubernetes.cri-o.ImageName";
|
||||||
const KATA_VIRTUAL_VOLUME_PREFIX: &str = "io.katacontainers.volume=";
|
|
||||||
const KATA_VIRTUAL_VOLUME_TYPE_OVERLAY_FS: &str = "overlayfs";
|
const KATA_VIRTUAL_VOLUME_TYPE_OVERLAY_FS: &str = "overlayfs";
|
||||||
const KATA_GUEST_ROOT_SHARED_FS: &str = "/run/kata-containers/";
|
const KATA_GUEST_ROOT_SHARED_FS: &str = "/run/kata-containers/";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user