MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / parse_dstack_options

Function parse_dstack_options

dstack-util/src/system_setup.rs:156–182  ·  view source on GitHub ↗
(shared: &HostShared)

Source from the content-addressed store, hash-verified

154}
155
156fn parse_dstack_options(shared: &HostShared) -> Result<DstackOptions> {
157 let cmdline = fs::read_to_string("/proc/cmdline").context("Failed to read /proc/cmdline")?;
158
159 let mut options = DstackOptions {
160 storage_encrypted: true, // Default to encryption enabled
161 storage_fs: FsType::Zfs, // Default to ZFS
162 };
163
164 for param in cmdline.split_whitespace() {
165 if let Some(value) = param.strip_prefix("dstack.storage_encrypted=") {
166 match value {
167 "0" | "false" | "no" | "off" => options.storage_encrypted = false,
168 "1" | "true" | "yes" | "on" => options.storage_encrypted = true,
169 _ => {
170 bail!("Invalid value for dstack.storage_encrypted: {value}");
171 }
172 }
173 } else if let Some(value) = param.strip_prefix("dstack.storage_fs=") {
174 options.storage_fs = value.parse().context("Failed to parse dstack.storage_fs")?;
175 }
176 }
177
178 if let Some(fs) = &shared.app_compose.storage_fs {
179 options.storage_fs = fs.parse().context("Failed to parse storage_fs")?;
180 }
181 Ok(options)
182}
183
184#[derive(Clone)]
185pub struct HostShareDir {

Callers 1

setup_fsMethod · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected