mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-03 21:21:32 +00:00
feat: oci tar format, bit-perfect disk storage for config and manifest, concurrent image pulls (#88)
* oci: retain bit-perfect copies of manifest and config on disk * feat: oci tar format support * feat: concurrent image pulls
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
use anyhow::Result;
|
||||
use backhand::{FilesystemWriter, NodeHeader};
|
||||
use krata::launchcfg::LaunchInfo;
|
||||
use krataoci::packer::OciImagePacked;
|
||||
use krataoci::packer::OciPackedImage;
|
||||
use log::trace;
|
||||
use std::fs;
|
||||
use std::fs::File;
|
||||
@ -9,13 +9,13 @@ use std::path::PathBuf;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub struct ConfigBlock<'a> {
|
||||
pub image: &'a OciImagePacked,
|
||||
pub image: &'a OciPackedImage,
|
||||
pub file: PathBuf,
|
||||
pub dir: PathBuf,
|
||||
}
|
||||
|
||||
impl ConfigBlock<'_> {
|
||||
pub fn new<'a>(uuid: &Uuid, image: &'a OciImagePacked) -> Result<ConfigBlock<'a>> {
|
||||
pub fn new<'a>(uuid: &Uuid, image: &'a OciPackedImage) -> Result<ConfigBlock<'a>> {
|
||||
let mut dir = std::env::temp_dir().clone();
|
||||
dir.push(format!("krata-cfg-{}", uuid));
|
||||
fs::create_dir_all(&dir)?;
|
||||
@ -26,7 +26,7 @@ impl ConfigBlock<'_> {
|
||||
|
||||
pub fn build(&self, launch_config: &LaunchInfo) -> Result<()> {
|
||||
trace!("build launch_config={:?}", launch_config);
|
||||
let manifest = self.image.config.to_string()?;
|
||||
let config = self.image.config.raw();
|
||||
let launch = serde_json::to_string(launch_config)?;
|
||||
let mut writer = FilesystemWriter::default();
|
||||
writer.push_dir(
|
||||
@ -39,7 +39,7 @@ impl ConfigBlock<'_> {
|
||||
},
|
||||
)?;
|
||||
writer.push_file(
|
||||
manifest.as_bytes(),
|
||||
config,
|
||||
"/image/config.json",
|
||||
NodeHeader {
|
||||
permissions: 384,
|
||||
|
@ -10,7 +10,7 @@ use krata::launchcfg::{
|
||||
LaunchInfo, LaunchNetwork, LaunchNetworkIpv4, LaunchNetworkIpv6, LaunchNetworkResolver,
|
||||
LaunchPackedFormat, LaunchRoot,
|
||||
};
|
||||
use krataoci::packer::OciImagePacked;
|
||||
use krataoci::packer::OciPackedImage;
|
||||
use tokio::sync::Semaphore;
|
||||
use uuid::Uuid;
|
||||
use xenclient::{DomainChannel, DomainConfig, DomainDisk, DomainNetworkInterface};
|
||||
@ -30,7 +30,7 @@ pub struct GuestLaunchRequest {
|
||||
pub env: HashMap<String, String>,
|
||||
pub run: Option<Vec<String>>,
|
||||
pub debug: bool,
|
||||
pub image: OciImagePacked,
|
||||
pub image: OciPackedImage,
|
||||
}
|
||||
|
||||
pub struct GuestLauncher {
|
||||
|
Reference in New Issue
Block a user