update gpu-switch-mode-indicator.tsx

This commit is contained in:
MacRimi
2026-04-19 12:26:52 +02:00
parent bcca760403
commit 834795d6d9
15 changed files with 1235 additions and 119 deletions

View File

@@ -1255,6 +1255,48 @@ if [[ ${#EFFECTIVE_IMPORT_DISKS[@]} -gt 0 ]]; then
done
fi
if [[ ${#CONTROLLER_NVME_PCIS[@]} -gt 0 ]]; then
# SR-IOV guard: exclude VFs / active PFs before staging. Mid-flow
# phase-2 output; a whiptail msgbox stops the scrolling so the user
# actually sees which devices were dropped. After the ack, each
# skipped BDF is logged via msg_warn so the action is visible in the
# captured log as well.
if declare -F _pci_sriov_filter_array >/dev/null 2>&1; then
SRIOV_REMOVED=$(_pci_sriov_filter_array CONTROLLER_NVME_PCIS)
if [[ -n "$SRIOV_REMOVED" ]]; then
SRIOV_MSG=""
SRIOV_BDFS=()
SRIOV_NL=$'\n'
SRIOV_MSG="$(translate "The following devices were excluded from Controller/NVMe passthrough because they are part of an SR-IOV configuration:")"
while IFS= read -r SRIOV_ENTRY; do
[[ -z "$SRIOV_ENTRY" ]] && continue
SRIOV_BDF="${SRIOV_ENTRY%%|*}"
SRIOV_ROLE="${SRIOV_ENTRY#*|}"
SRIOV_FIRST="${SRIOV_ROLE%% *}"
SRIOV_BDFS+=("$SRIOV_BDF")
if [[ "$SRIOV_FIRST" == "vf" ]]; then
SRIOV_MSG+="${SRIOV_NL}${SRIOV_BDF}$(translate "Virtual Function")"
else
SRIOV_MSG+="${SRIOV_NL}${SRIOV_BDF}$(translate "Physical Function with") ${SRIOV_ROLE#pf-active } $(translate "active VFs")"
fi
done <<< "$SRIOV_REMOVED"
SRIOV_MSG+="${SRIOV_NL}${SRIOV_NL}$(translate "To pass SR-IOV Virtual Functions to a VM, edit the VM configuration manually via the Proxmox web interface.")"
whiptail --backtitle "ProxMenux" \
--title "$(translate "SR-IOV Configuration Detected")" \
--msgbox "$SRIOV_MSG" 18 82
for SRIOV_SKIPPED in "${SRIOV_BDFS[@]}"; do
msg_warn "$(translate "Skipping SR-IOV device"): ${SRIOV_SKIPPED}"
done
fi
fi
if [[ ${#CONTROLLER_NVME_PCIS[@]} -eq 0 ]]; then
msg_warn "$(translate "No eligible Controller/NVMe devices remain after SR-IOV filtering. Skipping.")"
fi
fi
if [[ ${#CONTROLLER_NVME_PCIS[@]} -gt 0 ]]; then
local CONTROLLER_CAN_STAGE=true
if declare -F _pci_is_iommu_active >/dev/null 2>&1 && ! _pci_is_iommu_active; then

View File

@@ -468,6 +468,55 @@ fi
done
fi
if [[ ${#CONTROLLER_NVME_PCIS[@]} -gt 0 ]]; then
# SR-IOV guard: drop Virtual Functions / active-PFs before staging.
# Proxmox's VFIO rebind via qm hostpci would trigger the same VF-tree
# collapse described in the GPU flows, so we exclude them and tell
# the user to manage those passthroughs manually.
#
# UI choice: this runs mid-flow (phase 2 of the wizard, interleaved
# with msg_info/msg_ok output), so a whiptail msgbox is used to force
# the user to acknowledge the exclusion instead of letting the notice
# scroll by with the rest of the processing output. After the user
# clicks OK, a per-device msg_warn is emitted so the skipped BDFs
# remain visible in the captured log.
if declare -F _pci_sriov_filter_array >/dev/null 2>&1; then
local _sriov_removed=""
_sriov_removed=$(_pci_sriov_filter_array CONTROLLER_NVME_PCIS)
if [[ -n "$_sriov_removed" ]]; then
local _sriov_msg="" _entry _bdf _role _first _sb
local -a _sriov_bdfs=()
local _nl=$'\n'
_sriov_msg="$(translate "The following devices were excluded from Controller/NVMe passthrough because they are part of an SR-IOV configuration:")"
while IFS= read -r _entry; do
[[ -z "$_entry" ]] && continue
_bdf="${_entry%%|*}"
_role="${_entry#*|}"
_first="${_role%% *}"
_sriov_bdfs+=("$_bdf")
if [[ "$_first" == "vf" ]]; then
_sriov_msg+="${_nl}${_bdf}$(translate "Virtual Function")"
else
_sriov_msg+="${_nl}${_bdf}$(translate "Physical Function with") ${_role#pf-active } $(translate "active VFs")"
fi
done <<< "$_sriov_removed"
_sriov_msg+="${_nl}${_nl}$(translate "To pass SR-IOV Virtual Functions to a VM, edit the VM configuration manually via the Proxmox web interface.")"
whiptail --backtitle "ProxMenux" \
--title "$(translate "SR-IOV Configuration Detected")" \
--msgbox "$_sriov_msg" 18 82
for _sb in "${_sriov_bdfs[@]}"; do
msg_warn "$(translate "Skipping SR-IOV device"): ${_sb}"
done
fi
fi
if [[ ${#CONTROLLER_NVME_PCIS[@]} -eq 0 ]]; then
msg_warn "$(translate "No eligible Controller/NVMe devices remain after SR-IOV filtering. Skipping.")"
fi
fi
if [[ ${#CONTROLLER_NVME_PCIS[@]} -gt 0 ]]; then
local CONTROLLER_CAN_STAGE=true
if declare -F _pci_is_iommu_active >/dev/null 2>&1 && ! _pci_is_iommu_active; then

View File

@@ -1270,6 +1270,48 @@ function create_vm() {
done
fi
if [[ ${#CONTROLLER_NVME_PCIS[@]} -gt 0 ]]; then
# SR-IOV guard: mirror of the synology.sh/vm_creator.sh block —
# drop VFs and active-PF devices before staging so Proxmox does
# not collapse the VF tree at VM start. Mid-flow, so the notice
# goes through whiptail (blocking acknowledgment) and each
# skipped BDF is then echoed via msg_warn for the log trail.
if declare -F _pci_sriov_filter_array >/dev/null 2>&1; then
SRIOV_REMOVED=$(_pci_sriov_filter_array CONTROLLER_NVME_PCIS)
if [[ -n "$SRIOV_REMOVED" ]]; then
SRIOV_MSG=""
SRIOV_BDFS=()
SRIOV_NL=$'\n'
SRIOV_MSG="$(translate "The following devices were excluded from Controller/NVMe passthrough because they are part of an SR-IOV configuration:")"
while IFS= read -r SRIOV_ENTRY; do
[[ -z "$SRIOV_ENTRY" ]] && continue
SRIOV_BDF="${SRIOV_ENTRY%%|*}"
SRIOV_ROLE="${SRIOV_ENTRY#*|}"
SRIOV_FIRST="${SRIOV_ROLE%% *}"
SRIOV_BDFS+=("$SRIOV_BDF")
if [[ "$SRIOV_FIRST" == "vf" ]]; then
SRIOV_MSG+="${SRIOV_NL}${SRIOV_BDF}$(translate "Virtual Function")"
else
SRIOV_MSG+="${SRIOV_NL}${SRIOV_BDF}$(translate "Physical Function with") ${SRIOV_ROLE#pf-active } $(translate "active VFs")"
fi
done <<< "$SRIOV_REMOVED"
SRIOV_MSG+="${SRIOV_NL}${SRIOV_NL}$(translate "To pass SR-IOV Virtual Functions to a VM, edit the VM configuration manually via the Proxmox web interface.")"
whiptail --backtitle "ProxMenux" \
--title "$(translate "SR-IOV Configuration Detected")" \
--msgbox "$SRIOV_MSG" 18 82
for SRIOV_SKIPPED in "${SRIOV_BDFS[@]}"; do
msg_warn "$(translate "Skipping SR-IOV device"): ${SRIOV_SKIPPED}"
done
fi
fi
if [[ ${#CONTROLLER_NVME_PCIS[@]} -eq 0 ]]; then
msg_warn "$(translate "No eligible Controller/NVMe devices remain after SR-IOV filtering. Skipping.")"
fi
fi
if [[ ${#CONTROLLER_NVME_PCIS[@]} -gt 0 ]]; then
local CONTROLLER_CAN_STAGE=true
if declare -F _pci_is_iommu_active >/dev/null 2>&1 && ! _pci_is_iommu_active; then