Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ks: merge fyp to main #1

Open
wants to merge 176 commits into
base: sc2-main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
a0bde8d
add logging image pulling
konsougiou Mar 4, 2024
6bf0e78
logg nydus image check
konsougiou Mar 5, 2024
bf8e122
patched Cargo.toml kata-cc-native-tls to not include overlay-fs
konsougiou Mar 5, 2024
65fc28b
add nix dep to nydus feature deps
konsougiou Mar 6, 2024
677c2e0
update toml to include overlay-fs
konsougiou Mar 22, 2024
28f05b9
logging layer and image db entries after pull
konsougiou Mar 22, 2024
aa23c32
layer_db display bug
konsougiou Mar 22, 2024
753c8c3
bug fix
konsougiou Mar 22, 2024
fa68ad9
bug fix
konsougiou Mar 22, 2024
5380ca0
add fuse deamon logs
konsougiou Mar 23, 2024
294734a
log cleanup for experiments
konsougiou Mar 30, 2024
3889b10
layer digest bugfix
konsougiou Mar 30, 2024
4d7f884
Pull Layers log
konsougiou Mar 30, 2024
a6738c9
comment out extra logs for experiments
konsougiou Apr 15, 2024
6ce0021
comment out layer pull
konsougiou Apr 17, 2024
6772852
dm verity logs
konsougiou Apr 21, 2024
7090133
add dm verity creation error
konsougiou Apr 21, 2024
8cad985
add dm verity creation error
konsougiou Apr 21, 2024
ade4c1c
add dm verity creation error
konsougiou Apr 21, 2024
feb51c8
add dm verity creation error
konsougiou Apr 21, 2024
9789e6f
dm daemon start commands
konsougiou May 2, 2024
9eaadbd
udev/control access
konsougiou May 3, 2024
4e41d8a
udev/control access
konsougiou May 3, 2024
6cbc992
udev/control access
konsougiou May 3, 2024
6bfb09c
dm tabel lload logs
konsougiou May 3, 2024
0d29093
dm tabel load error handling
konsougiou May 3, 2024
73c8005
dm tabel load error handling
konsougiou May 3, 2024
4c63321
dm tabel load error handling
konsougiou May 3, 2024
cbe48ee
tmp
konsougiou May 3, 2024
286c38c
tmp
konsougiou May 3, 2024
78df2b3
tmp
konsougiou May 3, 2024
b86f709
tmp
konsougiou May 3, 2024
818f1fc
tmp
konsougiou May 3, 2024
f4c1557
tmp
konsougiou May 3, 2024
f8bb493
tmp
konsougiou May 3, 2024
b1fe80c
tmp
konsougiou May 3, 2024
0aa81e9
tmp
konsougiou May 3, 2024
e809efa
tmp
konsougiou May 3, 2024
1b1c7c3
tmp
konsougiou May 3, 2024
58d6654
tmp
konsougiou May 3, 2024
39b9011
tmp
konsougiou May 3, 2024
43a4430
tmp
konsougiou May 3, 2024
091f2e1
tmp
konsougiou May 3, 2024
898eea7
tmp
konsougiou May 3, 2024
60a6309
tmp
konsougiou May 3, 2024
82b1071
tmp
konsougiou May 3, 2024
7fd9f57
tmp
konsougiou May 3, 2024
a1790a6
tmp
konsougiou May 3, 2024
338196d
tmp
konsougiou May 3, 2024
b1272f3
update
konsougiou May 4, 2024
ee7e301
update
konsougiou May 4, 2024
13d897a
dev info
konsougiou May 4, 2024
c05a384
dev info
konsougiou May 4, 2024
91d8230
update devmapper
konsougiou May 4, 2024
69ac33d
update devmapper
konsougiou May 4, 2024
8d3b167
update devmapper
konsougiou May 4, 2024
d65e5ba
update devmapper
konsougiou May 4, 2024
c9e2da4
update devmapper
konsougiou May 4, 2024
4582eff
update devmapper
konsougiou May 4, 2024
3cebd51
update devmapper
konsougiou May 4, 2024
7dbf92c
update devmapper
konsougiou May 4, 2024
64a4395
logs added
konsougiou May 4, 2024
a1ddfce
logs added
konsougiou May 5, 2024
3162274
update devmapper
konsougiou May 5, 2024
507d174
list devices
konsougiou May 5, 2024
776c70a
tmp
konsougiou May 5, 2024
3908329
remove udev start
konsougiou May 5, 2024
61eb450
remove udev start
konsougiou May 5, 2024
fd17584
remove udev start
konsougiou May 5, 2024
62b6c00
star tudev
konsougiou May 6, 2024
a6cf4e0
fuse daemon logs
konsougiou May 11, 2024
445ba1f
update nydus-service
konsougiou May 12, 2024
89f250d
patch cargo.toml
konsougiou May 12, 2024
5c4e43f
patch config
konsougiou May 12, 2024
c229215
patch config
konsougiou May 12, 2024
88ac5f2
patch config
konsougiou May 12, 2024
af0ba44
patch config
konsougiou May 12, 2024
6e0f73b
nydus
konsougiou May 12, 2024
03e13bd
nydus
konsougiou May 12, 2024
99f5437
deps
konsougiou May 12, 2024
3de34e5
deps
konsougiou May 12, 2024
df786b4
deps
konsougiou May 12, 2024
5b1ffc3
deps
konsougiou May 12, 2024
06782f9
deps
konsougiou May 12, 2024
ad77611
deps
konsougiou May 12, 2024
f944022
update nydsu-service
konsougiou May 12, 2024
40d6c6f
deps
konsougiou May 12, 2024
4c9b4e8
deps
konsougiou May 12, 2024
f9ceb00
logs
konsougiou May 13, 2024
b0a7393
logs
konsougiou May 13, 2024
1d626dd
logs
konsougiou May 13, 2024
e933b83
logs
konsougiou May 13, 2024
4c4449a
logs
konsougiou May 13, 2024
7294596
dummy prefetch
konsougiou May 14, 2024
070783d
dummy prefetch
konsougiou May 14, 2024
2be2e53
dummy prefetch
konsougiou May 14, 2024
a7edc31
dummy prefetch
konsougiou May 14, 2024
c348bc6
dummy prefetch
konsougiou May 14, 2024
70f7fbd
prefetch
konsougiou May 14, 2024
e051fa7
prefetch
konsougiou May 14, 2024
e8d976a
prefetch
konsougiou May 14, 2024
45223fa
prefetch
konsougiou May 14, 2024
8271456
prefetch
konsougiou May 14, 2024
77a1f46
prefetch
konsougiou May 14, 2024
5bd9e07
prefetch
konsougiou May 14, 2024
a56c82b
prefetch
konsougiou May 14, 2024
f8d7a82
prefetch
konsougiou May 14, 2024
a5be00f
image url log
konsougiou May 18, 2024
5397f4b
update nydus
konsougiou May 18, 2024
5e8ffb8
fix
konsougiou May 18, 2024
025801f
update nydus
konsougiou May 19, 2024
4eb3d4c
fix
konsougiou May 19, 2024
4fb3f89
fix
konsougiou May 20, 2024
542d274
fix
konsougiou May 20, 2024
9b0b2a0
fix
konsougiou May 20, 2024
9f0f856
fix
konsougiou May 20, 2024
8288ec1
fix
konsougiou May 20, 2024
080edd9
update nydus
konsougiou May 20, 2024
8f5d29e
update nydus
konsougiou May 20, 2024
3c34ccb
fix
konsougiou May 20, 2024
c43a055
fix
konsougiou May 20, 2024
df6f132
less logs
konsougiou May 20, 2024
a281140
less logs
konsougiou May 20, 2024
0828203
update nydus
konsougiou May 21, 2024
7020629
update nydus
konsougiou May 21, 2024
f26cfeb
fix
konsougiou May 21, 2024
8f1ca79
fix
konsougiou May 21, 2024
97d448f
adjust image_url
konsougiou May 21, 2024
65a7def
adjust image_url
konsougiou May 21, 2024
3842597
logs
konsougiou May 21, 2024
503c9c4
fix
konsougiou May 21, 2024
4a6eb01
update nydus
konsougiou May 23, 2024
9f9baa4
update nydus
konsougiou May 23, 2024
fb8d452
update nydus
konsougiou May 23, 2024
e725e4b
update nydus
konsougiou May 23, 2024
17c0537
update nydus
konsougiou May 23, 2024
a76f222
update nydus
konsougiou May 23, 2024
075eb04
update nydus
konsougiou May 24, 2024
42efcc0
update nydsu
konsougiou May 24, 2024
80e3565
nydus
konsougiou May 24, 2024
b02647e
nydus
konsougiou May 24, 2024
115152f
nydus
konsougiou May 24, 2024
8023b0d
nydus
konsougiou May 24, 2024
0bf09e9
nydus
konsougiou May 24, 2024
eadc659
nydus
konsougiou May 24, 2024
3456355
nydus
konsougiou May 24, 2024
e568471
nydus
konsougiou May 24, 2024
2a523c8
nydus
konsougiou May 24, 2024
6853c76
nydus
konsougiou May 24, 2024
c65a0fa
nydus
konsougiou May 24, 2024
f8b0f6a
nydus
konsougiou May 24, 2024
26ed375
fix
konsougiou May 24, 2024
39f0637
fix
konsougiou May 24, 2024
130a70b
fix
konsougiou May 24, 2024
b9ed5ee
fix
konsougiou May 25, 2024
11073d7
fix
konsougiou May 25, 2024
58b735c
fix
konsougiou May 25, 2024
957fa4d
fix
konsougiou May 25, 2024
441c5ff
fix
konsougiou May 25, 2024
bfab625
fix
konsougiou May 25, 2024
9cf1b34
fix
konsougiou May 25, 2024
1ec97c5
fix
konsougiou May 25, 2024
0d8912e
fix
konsougiou May 25, 2024
11fa750
fix
konsougiou May 25, 2024
3171502
fix
konsougiou May 25, 2024
583ef4a
fix
konsougiou May 25, 2024
8e0c3e2
fix
konsougiou May 25, 2024
b5a7420
fix
konsougiou May 25, 2024
208ba00
fix
konsougiou May 25, 2024
1c0ffab
fix
konsougiou May 25, 2024
bceaf24
fix
konsougiou May 25, 2024
287e69b
fix
konsougiou May 25, 2024
a7bb030
fix
konsougiou May 25, 2024
acf1d2f
fix
konsougiou May 25, 2024
6cc3115
fix
konsougiou May 26, 2024
233e4ff
fix
konsougiou May 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

.DS_Store

.vscode

image-rs/scripts/attestation-agent
shell.nix
16 changes: 11 additions & 5 deletions image-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ attestation_agent = { path = "../attestation-agent/lib", default-features = fals
base64.workspace = true
cfg-if = { workspace = true, optional = true }
devicemapper = { version = "0.33.5", optional = true }
#devicemapper = { git="https://github.com/konsougiou/devicemapper-rs", rev="29d6dd5", optional = true}
dircpy = { version = "0.3.12", optional = true }
flate2 = "1.0"
flate2 = "1.0.25"
fs_extra = { version = "1.2.0", optional = true }
futures = { version = "0.3.28", optional = true }
futures-util = "0.3"
Expand All @@ -41,16 +42,19 @@ sha2.workspace = true
sigstore = { git = "https://github.com/sigstore/sigstore-rs.git", rev = "69e8f33", default-features = false, optional = true}
strum.workspace = true
strum_macros = "0.25"
tar = "0.4.37"
#tar = "0.4.37"
tar = "0.4.40"
tokio.workspace = true
tonic = { workspace = true, optional = true }
ttrpc = { workspace = true, features = [ "async" ], optional = true }
url = "2.2.2"
walkdir = "2"
zstd = "0.12"

nydus-api = { version = "0.3.0", optional = true}
nydus-service = { version = "0.3.0", features = ["coco"], optional = true}
nydus-api = { git="https://github.com/konsougiou/nydus.git", rev="440eee9", default-features = false, optional = true}
#nydus-api = { version = "0.3.0", optional = true}
nydus-service = { git="https://github.com/konsougiou/nydus.git", rev="440eee9", features = ["coco"], default-features = false, optional = true}
#nydus-service = { version = "0.3.0", features = ["coco"], optional = true}

[build-dependencies]
anyhow.workspace = true
Expand Down Expand Up @@ -81,11 +85,13 @@ default = ["snapshot-overlayfs", "signature-cosign-rustls", "keywrap-grpc", "oci

# This will be based on `ring` dependency
kata-cc-rustls-tls = ["encryption-ring", "keywrap-ttrpc", "snapshot-overlayfs", "signature-cosign-rustls", "signature-simple", "getresource", "oci-distribution/rustls-tls"]

enclave-cc-eaakbc-rustls-tls = ["encryption-ring", "keywrap-native", "eaa-kbc", "snapshot-unionfs", "signature-simple", "getresource", "signature-cosign-rustls", "oci-distribution-rustls"]
enclave-cc-cckbc-rustls-tls = ["encryption-ring", "keywrap-native", "cc-kbc-sgx", "snapshot-unionfs", "signature-simple", "getresource", "signature-cosign-rustls", "oci-distribution-rustls"]

# This will be based on `openssl` dependency
kata-cc-native-tls = ["encryption-openssl", "keywrap-ttrpc", "snapshot-overlayfs", "signature-cosign-native", "signature-simple", "getresource", "oci-distribution/native-tls"]
#kata-cc-native-tls = ["encryption-openssl", "keywrap-ttrpc", "signature-cosign-native", "signature-simple", "getresource", "oci-distribution/native-tls"]
enclave-cc-eaakbc-native-tls = ["encryption-openssl", "keywrap-native", "eaa-kbc", "snapshot-unionfs", "signature-simple", "getresource", "signature-cosign-native", "oci-distribution-native"]
enclave-cc-cckbc-native-tls = ["encryption-openssl", "keywrap-native", "cc-kbc-sgx", "snapshot-unionfs", "signature-simple", "getresource", "signature-cosign-native", "oci-distribution-native"]

Expand Down Expand Up @@ -120,6 +126,6 @@ snapshot-unionfs = ["nix", "dircpy", "fs_extra"]

getresource = [ "lazy_static", "cfg-if" ]

nydus = ["lazy_static", "nydus-api", "nydus-service"]
nydus = ["nix", "lazy_static", "nydus-api", "nydus-service"]

verity = ["devicemapper"]
113 changes: 109 additions & 4 deletions image-rs/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ use oci_spec::image::{ImageConfiguration, Os};
use serde::Deserialize;
use std::collections::{BTreeSet, HashMap};
use std::convert::TryFrom;
use std::path::Path;
use std::sync::Arc;

use tokio::task;
use std::path::Path;
use std::fs::{self, File};
use std::io::Write;
use std::process::Command;
use std::str;
use reqwest::blocking::Client;

use tokio::sync::Mutex;

use crate::bundle::{create_runtime_config, BUNDLE_ROOTFS};
Expand Down Expand Up @@ -98,6 +105,9 @@ impl Default for ImageClient {
// construct a default instance of `ImageClient`
fn default() -> ImageClient {
let config = ImageConfig::try_from(Path::new(CONFIGURATION_FILE_PATH)).unwrap_or_default();

//println!("KS-image-rs: Starting ImageClient with config: ({:?})", config);

let meta_store = MetaStore::try_from(Path::new(METAFILE)).unwrap_or_default();

#[allow(unused_mut)]
Expand All @@ -114,6 +124,8 @@ impl Default for ImageClient {
data_dir,
std::sync::atomic::AtomicUsize::new(*overlay_index),
);

//println!("KS-image-rs: Starting overlayfs snapshotter");
snapshots.insert(
SnapshotType::Overlay,
Box::new(overlayfs) as Box<dyn Snapshotter>,
Expand Down Expand Up @@ -146,6 +158,54 @@ impl Default for ImageClient {
}
}

fn dummy_prefetch() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let blob_ids = ["ac2c9c7c25e992c7a0f1b6261112df95281324d8229541317f763dfaf01c7f30", "c737fc16374b9e9a352300146ab49de56f0068e42618fe2ebe3323d4069b7b89"];
let cache_dir = "/opt/nydus/cache/";
println!("KS: dummy pre-fetch");
fs::create_dir_all(cache_dir)?;

for &blob_id in &blob_ids {
println!("KS: pre fetching blob_id: {}", blob_id);
let url = format!("https://external-registry.coco-csg.com/v2/tf-serving-tinybert/blobs/sha256:{}", blob_id);
let response = client.get(&url).send()?;

if response.status().is_success() {
let content = response.bytes()?;

let cache_path = format!("{}{}", cache_dir, blob_id);
let mut file = File::create(cache_path)?;
file.write_all(&content)?;
} else {
eprintln!("KS Failed to fetch blob: {}", blob_id);
}
}

let cmd = "ls /opt/nydus/cache/";
let output = Command::new("sh")
.arg("-c")
.arg(cmd)
.output()
.expect("Failed to execute 'ls' command");

if output.status.success() {
let stdout = str::from_utf8(&output.stdout)
.unwrap_or("Failed to decode stdout as UTF-8");
for line in stdout.split('\n') {
if !line.is_empty() {
println!("Blob: {}", line);
}
}
} else {
let stderr = str::from_utf8(&output.stderr)
.unwrap_or("Failed to decode stderr as UTF-8");
eprintln!("Failed to execute '{}': {}", cmd, stderr);
}

Ok(())
}


impl ImageClient {
/// pull_image pulls an image with optional auth info and decrypt config
/// and store the pulled data under user defined work_dir/layers.
Expand All @@ -166,7 +226,20 @@ impl ImageClient {
auth_info: &Option<&str>,
decrypt_config: &Option<&str>,
) -> Result<String> {

// task::spawn_blocking(|| {
// if let Err(e) = dummy_prefetch() {
// eprintln!("Error occurred: {}", e);
// }
// }).await?;

//let image_url = "external-registry.coco-csg.com/tf-serving-tinybert:unencrypted-nydus";
//println!("KS-image-rs: pull_image called with image_url {:?}", image_url);
let image_url: &str = &image_url.replace("blob-cache", "unencrypted-nydus");
println!("KS-image-rs: adjusted image_url {:?}", image_url);

let reference = Reference::try_from(image_url)?;
//let reference = Reference::try_from("external-registry.coco-csg.com/tf-serving-tinybert:unencrypted-nydus")?;

// Try to get auth using input param.
let auth = if let Some(auth_info) = auth_info {
Expand Down Expand Up @@ -232,15 +305,20 @@ impl ImageClient {
(false, true) => RegistryAuth::Anonymous,
_ => auth.expect("unexpected uninitialized auth"),
};
//println!("KS-image-rs: Instantiating PullClient");

let mut client = PullClient::new(
reference,
&self.config.work_dir.join("layers"),
&auth,
self.config.max_concurrent_download,
)?;
//println!("CSG-M4GIC: B3G1N: (KS-image-rs) Pull Manifest");

let (image_manifest, image_digest, image_config) = client.pull_manifest().await?;

//println!("CSG-M4GIC: END: (KS-image-rs) Pull Manifest");

let id = image_manifest.config.digest.clone();

let snapshot = match self.snapshots.get_mut(&self.config.default_snapshot) {
Expand All @@ -255,6 +333,7 @@ impl ImageClient {

#[cfg(feature = "nydus")]
if utils::is_nydus_image(&image_manifest) {
println!("KS-image-rs: Nydus image detected");
{
let m = self.meta_store.lock().await;
if let Some(image_data) = &m.image_db.get(&id) {
Expand All @@ -281,8 +360,8 @@ impl ImageClient {
&image_digest,
&image_config,
)?;

return self
//println!("CSG-M4GIC: B3G1N: (KS-image-rs) Nydus Image Pull");
let ret = self
.do_pull_image_with_nydus(
&mut client,
&mut image_data,
Expand All @@ -291,18 +370,22 @@ impl ImageClient {
bundle_dir,
)
.await;
//println!("CSG-M4GIC: END: (KS-image-rs) Nydus Image Pull");
return ret
}

// If image has already been populated, just create the bundle.
{
let m = self.meta_store.lock().await;
if let Some(image_data) = &m.image_db.get(&id) {
//println!("KS-image-rs: meta_store already populated with ({:?})", image_data);
return create_bundle(image_data, bundle_dir, snapshot);
}
}

#[cfg(feature = "signature")]
if self.config.security_validate {
println!("CSG-M4GIC: B3G1N: (KS-image-rs) Signature Validation");
crate::signature::allows_image(
image_url,
&image_digest,
Expand All @@ -311,6 +394,7 @@ impl ImageClient {
)
.await
.map_err(|e| anyhow!("Security validate failed: {:?}", e))?;
println!("CSG-M4GIC: END: (KS-image-rs) Signature Validation");
}

let (mut image_data, unique_layers, unique_diff_ids) = create_image_meta(
Expand All @@ -322,6 +406,7 @@ impl ImageClient {
)?;

let unique_layers_len = unique_layers.len();
//println!("CSG-M4GIC: B3G1N: Pull Layers ({:?})", image_url);
let layer_metas = client
.async_pull_layers(
unique_layers,
Expand All @@ -330,6 +415,7 @@ impl ImageClient {
self.meta_store.clone(),
)
.await?;
//println!("CSG-M4GIC: END: Pull Layers ({:?})", image_url);

image_data.layer_metas = layer_metas;
let layer_db: HashMap<String, LayerMeta> = image_data
Expand All @@ -338,7 +424,12 @@ impl ImageClient {
.map(|layer| (layer.compressed_digest.clone(), layer.clone()))
.collect();

// for (key, value) in layer_db.clone() {
// println!("KS-image-rs layer_db entry: {} => {:?}", key, value);
// }

self.meta_store.lock().await.layer_db.extend(layer_db);

if unique_layers_len != image_data.layer_metas.len() {
bail!(
" {} layers failed to pull",
Expand All @@ -354,6 +445,12 @@ impl ImageClient {
.image_db
.insert(image_data.id.clone(), image_data.clone());

let meta_store_lock = self.meta_store.lock().await;
// for (key, value) in meta_store_lock.image_db.iter() {
// println!("KS-image-rs image_db entry: {} => {:?}", key, value);
// }


Ok(image_id)
}

Expand All @@ -373,6 +470,8 @@ impl ImageClient {
bail!("Failed to get bootstrap id, diff_ids is empty");
};

//println!("CSG-M4GIC: B3G1N: (KS-image-rs) Nydus Bootstrap Pull");

let bootstrap = utils::get_nydus_bootstrap_desc(image_manifest)
.ok_or_else(|| anyhow!("Faild to get bootstrap oci descriptor"))?;
let layer_metas = client
Expand All @@ -383,6 +482,9 @@ impl ImageClient {
self.meta_store.clone(),
)
.await?;
//println!("CSG-M4GIC: END: (KS-image-rs) Nydus Bootstrap Pull");

//println!("CSG-M4GIC: B3G1N: (KS-image-rs) Handle Bootstrap");
image_data.layer_metas = vec![layer_metas];
let layer_db: HashMap<String, LayerMeta> = image_data
.layer_metas
Expand All @@ -408,9 +510,10 @@ impl ImageClient {
bail!(
"default snapshot {} not found",
&self.config.default_snapshot
);
);
}
};
//println!("KS-image-rs: Starting nydus service");
let image_id = service::start_nydus_service(
image_data,
reference,
Expand All @@ -427,6 +530,8 @@ impl ImageClient {
.image_db
.insert(image_data.id.clone(), image_data.clone());

//println!("CSG-M4GIC: END: (KS-image-rs) Handle Bootstrap");

Ok(image_id)
}
}
Expand Down
4 changes: 3 additions & 1 deletion image-rs/src/nydus/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub async fn start_nydus_service(
let work_dir_buf = work_dir.to_owned();

if nydus_config.is_fuse() {
//println!("KS-image-rs: fuse mode detected");
let fuse_config = nydus_config
.get_fuse_config()
.expect("Fuse configuration not found")
Expand All @@ -69,6 +70,7 @@ pub async fn start_nydus_service(
bail!("Failed to start nydus service, {:?}", e);
};
} else if nydus_config.is_fscache() {
//println!("KS-image-rs: fscache mode detected");
let fscache_config = nydus_config
.get_fscache_config()
.expect("Fscache configuration not found")
Expand All @@ -88,7 +90,6 @@ pub async fn start_nydus_service(
} else {
bootstrap_meta.compressed_digest.clone()
};

if let Err(e) = task::spawn_blocking(move || {
process_fscache_daemon(
id,
Expand Down Expand Up @@ -167,6 +168,7 @@ pub fn process_fuse_daemon(
reference.repository(),
work_dir.join("cache"),
);
//println!("KS-image-rs: process_fuse_deamon called, with reference: {:?}, config ({:?}), bootstrap ({:?}), mountpoint ({:?}), workdir ({:?}) and fuse_config ({:?})", reference, config, bootstrap, mountpoint, work_dir, fuse_config);

if !mountpoint.exists() {
std::fs::create_dir_all(mountpoint)?;
Expand Down
4 changes: 4 additions & 0 deletions image-rs/src/nydus/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ pub fn is_nydus_meta_layer(desc: &manifest::OciDescriptor) -> bool {
}

pub fn is_nydus_image(image_manifest: &manifest::OciImageManifest) -> bool {

//println!("KS-image-rs: Checking if image is nydus");
get_nydus_bootstrap_desc(image_manifest).is_some()
}

Expand All @@ -32,9 +34,11 @@ pub fn get_nydus_bootstrap_desc(
if is_nydus_meta_layer(desc) {
Some(desc.clone())
} else {
println!("KS-image-rs: is nydus meta layers == false");
None
}
} else {
//println!("KS-image-rs: layers is empty. Not a nydus image");
None
}
}
Expand Down
Loading