mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-04-25 00:46:21 +00:00
update m_storage_helpers.sh
This commit is contained in:
@@ -172,6 +172,8 @@ function _vm_storage_enable_iommu_cmdline() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _vm_storage_ensure_iommu_or_offer() {
|
function _vm_storage_ensure_iommu_or_offer() {
|
||||||
|
local reboot_policy="${VM_STORAGE_IOMMU_REBOOT_POLICY:-ask_now}"
|
||||||
|
|
||||||
if declare -F _pci_is_iommu_active >/dev/null 2>&1 && _pci_is_iommu_active; then
|
if declare -F _pci_is_iommu_active >/dev/null 2>&1 && _pci_is_iommu_active; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@@ -182,6 +184,12 @@ function _vm_storage_ensure_iommu_or_offer() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Wizard flow: if IOMMU was already configured in this run and reboot is pending,
|
||||||
|
# allow the user to continue planning storage selections without re-prompting.
|
||||||
|
if [[ "$reboot_policy" == "defer" && "${VM_STORAGE_IOMMU_PENDING_REBOOT:-0}" == "1" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
local prompt
|
local prompt
|
||||||
prompt="$(translate "IOMMU is not active on this system.")\n\n"
|
prompt="$(translate "IOMMU is not active on this system.")\n\n"
|
||||||
prompt+="$(translate "Controller/NVMe passthrough to VMs requires IOMMU enabled in BIOS/UEFI and kernel.")\n\n"
|
prompt+="$(translate "Controller/NVMe passthrough to VMs requires IOMMU enabled in BIOS/UEFI and kernel.")\n\n"
|
||||||
@@ -198,14 +206,13 @@ function _vm_storage_ensure_iommu_or_offer() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local reboot_policy="${VM_STORAGE_IOMMU_REBOOT_POLICY:-ask_now}"
|
|
||||||
if [[ "$reboot_policy" == "defer" ]]; then
|
if [[ "$reboot_policy" == "defer" ]]; then
|
||||||
VM_STORAGE_IOMMU_PENDING_REBOOT=1
|
VM_STORAGE_IOMMU_PENDING_REBOOT=1
|
||||||
export VM_STORAGE_IOMMU_PENDING_REBOOT
|
export VM_STORAGE_IOMMU_PENDING_REBOOT
|
||||||
whiptail --title "Reboot Required" --msgbox \
|
whiptail --title "Reboot Required" --msgbox \
|
||||||
"$(translate "IOMMU configured successfully.")\n\n$(translate "Continue the VM wizard and reboot the host at the end.")\n\n$(translate "Controller/NVMe passthrough will be available after reboot.")" \
|
"$(translate "IOMMU configured successfully.")\n\n$(translate "Continue the VM wizard and reboot the host at the end.")\n\n$(translate "You can now select Controller/NVMe devices in Storage Plan.")\n$(translate "Controller/NVMe passthrough will be applied after reboot.")" \
|
||||||
12 78
|
12 78
|
||||||
return 1
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if whiptail --title "Reboot Required" --yesno \
|
if whiptail --title "Reboot Required" --yesno \
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ initialize_cache
|
|||||||
SELECTED_VMID=""
|
SELECTED_VMID=""
|
||||||
SELECTED_VM_NAME=""
|
SELECTED_VM_NAME=""
|
||||||
declare -a SELECTED_CONTROLLER_PCIS=()
|
declare -a SELECTED_CONTROLLER_PCIS=()
|
||||||
|
IOMMU_PENDING_REBOOT=0
|
||||||
|
|
||||||
set_title() {
|
set_title() {
|
||||||
show_proxmenux_logo
|
show_proxmenux_logo
|
||||||
@@ -99,6 +100,10 @@ enable_iommu_cmdline() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_iommu_or_offer_enable() {
|
check_iommu_or_offer_enable() {
|
||||||
|
if [[ "${IOMMU_PENDING_REBOOT:-0}" == "1" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
if declare -F _pci_is_iommu_active >/dev/null 2>&1 && _pci_is_iommu_active; then
|
if declare -F _pci_is_iommu_active >/dev/null 2>&1 && _pci_is_iommu_active; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@@ -143,11 +148,13 @@ check_iommu_or_offer_enable() {
|
|||||||
msg_warn "$(translate "Rebooting the system...")"
|
msg_warn "$(translate "Rebooting the system...")"
|
||||||
reboot
|
reboot
|
||||||
else
|
else
|
||||||
msg_info2 "$(translate "Please reboot manually and run this option again.")"
|
IOMMU_PENDING_REBOOT=1
|
||||||
|
msg_warn "$(translate "Reboot postponed by user.")"
|
||||||
|
msg_info2 "$(translate "You can continue assigning Controller/NVMe now, but reboot the host before starting the VM.")"
|
||||||
msg_success "$(translate "Press Enter to continue...")"
|
msg_success "$(translate "Press Enter to continue...")"
|
||||||
read -r
|
read -r
|
||||||
fi
|
fi
|
||||||
return 1
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_target_vm() {
|
select_target_vm() {
|
||||||
@@ -474,6 +481,9 @@ apply_assignment() {
|
|||||||
|
|
||||||
if [[ "$assigned_count" -gt 0 ]]; then
|
if [[ "$assigned_count" -gt 0 ]]; then
|
||||||
msg_success "$(translate "Completed. Controller/NVMe passthrough configured for VM") ${SELECTED_VMID}."
|
msg_success "$(translate "Completed. Controller/NVMe passthrough configured for VM") ${SELECTED_VMID}."
|
||||||
|
if [[ "${IOMMU_PENDING_REBOOT:-0}" == "1" ]]; then
|
||||||
|
msg_warn "$(translate "IOMMU was configured during this run. Reboot the host before starting the VM.")"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
msg_warn "$(translate "No new Controller/NVMe entries were added.")"
|
msg_warn "$(translate "No new Controller/NVMe entries were added.")"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user