diff --git a/oci_util/src/models.rs b/oci_util/src/models.rs index 2f45c5d..9728e59 100644 --- a/oci_util/src/models.rs +++ b/oci_util/src/models.rs @@ -28,7 +28,6 @@ use self::aux::Set; use serde::{Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; -use std::ffi::OsString; pub const OCI_IMAGE_INDEX: &str = "application/vnd.oci.image.index.v1+json"; pub const OCI_MANIFEST: &str = "application/vnd.oci.image.manifest.v1+json"; @@ -181,7 +180,7 @@ pub struct OciInnerConfig { pub env: Option>, pub tty: Option, pub working_dir: Option, - pub volumes: Option>, + pub volumes: Option>, pub exposed_ports: Option>, pub user: Option, pub labels: Option>, diff --git a/xc-bin/src/image/patch.rs b/xc-bin/src/image/patch.rs index 5d827c7..172cc1b 100644 --- a/xc-bin/src/image/patch.rs +++ b/xc-bin/src/image/patch.rs @@ -192,7 +192,7 @@ impl PatchActions { destination: mount_point.to_path_buf(), required: *required, }; - config.mounts.insert(key, mountspec); + config.mounts.insert(key.to_string_lossy().to_string(), mountspec); } PatchActions::ModAllow { allows } => { for allow in allows.iter() { diff --git a/xc-bin/src/jailfile/directives/mod.rs b/xc-bin/src/jailfile/directives/mod.rs index eb257c7..acdbfe9 100644 --- a/xc-bin/src/jailfile/directives/mod.rs +++ b/xc-bin/src/jailfile/directives/mod.rs @@ -114,7 +114,7 @@ impl ConfigMod { } } Self::Volume(name, mount_spec) => { - config.mounts.insert(name.clone(), mount_spec.clone()); + config.mounts.insert(name.to_string_lossy().to_string(), mount_spec.clone()); } Self::WorkDir(entry_point, dir) => { let work_dir = dir.to_string(); diff --git a/xc/src/image_store/sqlite.rs b/xc/src/image_store/sqlite.rs index 3c98ca4..4b3cc55 100644 --- a/xc/src/image_store/sqlite.rs +++ b/xc/src/image_store/sqlite.rs @@ -255,15 +255,12 @@ impl ImageStore for SqliteImageStore { while let Ok(Some(row)) = rows.next() { let bytes: String = row.get(4)?; let manifest: JailImage = serde_json::from_str(&bytes)?; - let hn: String = row.get(0)?; - let image_reference = ImageReference { hostname: if hn.is_empty() { None } else { Some(hn) }, name: row.get(1)?, tag: ImageTag::Tag(row.get(2)?), }; - records.push(ImageRecord { image_reference, digest: row.get(3)?, diff --git a/xc/src/models/jail_image.rs b/xc/src/models/jail_image.rs index fa8539e..bd1feee 100644 --- a/xc/src/models/jail_image.rs +++ b/xc/src/models/jail_image.rs @@ -36,7 +36,6 @@ use oci_util::layer::ChainId; use oci_util::models::{FreeOciConfig, OciConfig, OciConfigRootFs, OciInnerConfig}; use serde::{de::Visitor, Deserialize, Deserializer, Serialize, Serializer}; use std::collections::HashMap; -use std::ffi::OsString; use varutil::string_interpolation::{InterpolatedString, Var}; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] @@ -153,7 +152,6 @@ pub struct JailConfig { /// The secure level this jail is required pub secure_level: i8, - // pub original_oci_config: Option, /// is vnet required #[serde(default)] pub vnet: bool, @@ -184,7 +182,7 @@ pub struct JailConfig { pub special_mounts: Vec, - pub mounts: HashMap, + pub mounts: HashMap, #[serde(default)] pub datasets: HashMap, diff --git a/xcd/src/instantiate.rs b/xcd/src/instantiate.rs index daff53e..856e8eb 100644 --- a/xcd/src/instantiate.rs +++ b/xcd/src/instantiate.rs @@ -201,7 +201,7 @@ impl AppliedInstantiateRequest { } } - mount_specs.remove(&req.dest); + mount_specs.remove(req.dest.to_str().unwrap()); } for (key, spec) in mount_specs.iter() { @@ -442,7 +442,7 @@ impl InstantiateBlueprint { } }; - let mount_spec = mount_specs.remove(&req.dest); + let mount_spec = mount_specs.remove(req.dest.to_str().unwrap()); if mount_spec.is_some() { added_mount_specs.insert(&req.dest, mount_spec.clone().unwrap()); diff --git a/xcd/src/ipc.rs b/xcd/src/ipc.rs index f14a616..275d888 100644 --- a/xcd/src/ipc.rs +++ b/xcd/src/ipc.rs @@ -1170,7 +1170,7 @@ async fn create_volume( { Ok(image) => { let specs = image.manifest.jail_config().mounts; - specs.get(&volume).cloned() + specs.get(volume.to_str().unwrap()).cloned() } Err(ImageStoreError::ManifestNotFound(manifest)) => { return enoent(&format!("no such manifest {manifest}"))