Files
ProxmoxVE/misc
MickLesk 6b9930c8df refactor(build.func): extract nested functions, recursion guard, GPU timeout, pvesm cache
Changes:
- Extract 7 functions from build_container() to module level:
  is_gpu_app(), detect_gpu_devices(), configure_usb_passthrough(),
  configure_gpu_passthrough(), configure_additional_devices(),
  get_container_gid(), pvesm_status_cached()
  Prevents function re-declaration on recursive retry attempts.

- Add recursion guard (_BUILD_DEPTH max 3) to build_container()
  to prevent infinite OOM→retry→OOM→retry loops (exit code 250).

- Add 30s timeout to multi-GPU selection prompt with auto-select
  fallback for the first available GPU type.

- Add pvesm_status_cached() with associative array cache keyed by
  arguments. Eliminates ~10 redundant pvesm subprocess calls during
  a single container creation flow. Applied to: check_storage_support(),
  select_storage(), resolve_storage_preselect(), create_lxc_container()
  rootdir/vztmpl validation, validate_storage_space(),
  choose_and_set_storage_for_file(), and settings validation.

- Simplify check_storage_support() from while-read loop to single
  pipeline with grep.
2026-03-23 20:26:36 +01:00
..