MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / qemu_guest_env_vars

Function qemu_guest_env_vars

crates/openshell-driver-vm/src/runtime.rs:273–292  ·  view source on GitHub ↗
(config: &VmLaunchConfig, dns_server: Option<String>)

Source from the content-addressed store, hash-verified

271}
272
273fn qemu_guest_env_vars(config: &VmLaunchConfig, dns_server: Option<String>) -> Vec<String> {
274 let mut env_vars = config.env.clone();
275
276 if let Some(ip) = &config.guest_ip
277 && let Some(host_ip) = &config.host_ip
278 {
279 env_vars.push(format!("VM_NET_IP={ip}"));
280 env_vars.push(format!("VM_NET_GW={host_ip}"));
281 }
282
283 if let Some(dns) = dns_server {
284 env_vars.push(format!("VM_NET_DNS={dns}"));
285 }
286
287 if config.gpu_bdf.is_some() {
288 env_vars.push("GPU_ENABLED=true".to_string());
289 }
290
291 env_vars
292}
293
294/// Escape a string for use inside bash double quotes.
295fn shell_escape(s: &str) -> String {

Calls 1

pushMethod · 0.80