| 336 | } |
| 337 | |
| 338 | std::vector<std::string> RuntimeManager::BuildRuntimeArgs( |
| 339 | const VmSpec& spec, |
| 340 | const std::string& control_socket) const { |
| 341 | std::vector<std::string> args = { |
| 342 | config_.runtime_path, |
| 343 | "--vm-id", spec.vm_id, |
| 344 | "--vm-dir", spec.vm_dir, |
| 345 | "--control-endpoint", control_socket, |
| 346 | "--interactive", "off", |
| 347 | "--kernel", spec.kernel_path, |
| 348 | "--memory", std::to_string(spec.memory_mb), |
| 349 | "--cpus", std::to_string(spec.cpu_count), |
| 350 | }; |
| 351 | if (!spec.initrd_path.empty()) { |
| 352 | args.push_back("--initrd"); |
| 353 | args.push_back(spec.initrd_path); |
| 354 | } |
| 355 | if (!spec.disk_path.empty()) { |
| 356 | args.push_back("--disk"); |
| 357 | args.push_back(spec.disk_path); |
| 358 | } |
| 359 | if (!spec.cmdline.empty()) { |
| 360 | args.push_back("--cmdline"); |
| 361 | args.push_back(spec.cmdline); |
| 362 | } |
| 363 | if (spec.nat_enabled) { |
| 364 | args.push_back("--net"); |
| 365 | } |
| 366 | if (spec.debug_mode) { |
| 367 | args.push_back("--debug"); |
| 368 | } |
| 369 | for (const auto& pf : spec.host_forwards) { |
| 370 | args.push_back("--hostfwd"); |
| 371 | args.push_back(pf.ToHostfwd()); |
| 372 | } |
| 373 | for (const auto& gf : EffectiveGuestForwards(spec)) { |
| 374 | args.push_back("--guestfwd"); |
| 375 | args.push_back(gf.ToGuestfwd()); |
| 376 | } |
| 377 | for (const auto& sf : spec.shared_folders) { |
| 378 | args.push_back("--share"); |
| 379 | args.push_back(sf.tag + ":" + sf.host_path + (sf.readonly ? ":ro" : "")); |
| 380 | } |
| 381 | return args; |
| 382 | } |
| 383 | |
| 384 | std::vector<GuestForward> RuntimeManager::EffectiveGuestForwards(const VmSpec& spec) const { |
| 385 | // Canonical guest-side endpoint that the LLM reverse proxy is |
nothing calls this directly
no test coverage detected