| 271 | } |
| 272 | |
| 273 | fn 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. |
| 295 | fn shell_escape(s: &str) -> String { |