update
This commit is contained in:
+76
-3
@@ -10,6 +10,7 @@ source /opt/idssys/ta-proxmenu/inc/header-info.inc
|
||||
source /opt/idssys/ta-proxmenu/inc/post-install.inc
|
||||
source /opt/idssys/ta-proxmenu/inc/rmm.inc
|
||||
source /opt/idssys/ta-proxmenu/inc/secure-input.inc
|
||||
source /opt/idssys/ta-proxmenu/inc/cpu-compat.inc
|
||||
source /opt/idssys/ta-proxmenu/inc/deploy-iso-nfs-lxc.sh
|
||||
source /opt/idssys/ta-proxmenu/inc/deploy-pulse-lxc.sh
|
||||
source /opt/idssys/ta-proxmenu/inc/virtio-helpers.inc
|
||||
@@ -1225,6 +1226,73 @@ TAPM_SET_QEMU_CPU_MODEL() {
|
||||
--cpu "$cpu_model"
|
||||
}
|
||||
|
||||
TAPM_NODE_CPU_NAME() {
|
||||
local node="${1:?node is required}"
|
||||
local status_json
|
||||
|
||||
status_json="$(
|
||||
pvesh get "/nodes/${node}/status" --output-format json 2>/dev/null
|
||||
)" || return 1
|
||||
|
||||
TAPM_NODE_STATUS_JSON="$status_json" python3 -c '
|
||||
import json
|
||||
import os
|
||||
|
||||
try:
|
||||
status = json.loads(os.environ["TAPM_NODE_STATUS_JSON"])
|
||||
except (KeyError, TypeError, ValueError):
|
||||
raise SystemExit(1)
|
||||
|
||||
cpu_info = status.get("cpuinfo") or {}
|
||||
model = str(cpu_info.get("model") or "").strip()
|
||||
if not model:
|
||||
raise SystemExit(1)
|
||||
|
||||
print(" ".join(model.split()))
|
||||
' 2>/dev/null
|
||||
}
|
||||
|
||||
TAPM_SHOW_CLUSTER_CPU_TABLE() {
|
||||
local proxclmc_output
|
||||
local host_rows
|
||||
local node
|
||||
local address
|
||||
local host_max
|
||||
local cpu_name
|
||||
local generation
|
||||
|
||||
proxclmc_output="$(proxclmc 2>/dev/null)" || proxclmc_output=""
|
||||
host_rows="$(printf '%s\n' "$proxclmc_output" | TAPM_PROXCLMC_HOST_ROWS)"
|
||||
|
||||
printf '\nCluster host CPU capabilities:\n\n'
|
||||
|
||||
if [[ -z "$host_rows" ]]; then
|
||||
echo -e " ${idsCL[Yellow]}Per-host CPU details were unavailable from ProxCLMC.${idsCL[Default]}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
printf ' %-16s %-42s %-34s %-14s\n' \
|
||||
'HOST' 'PHYSICAL CPU' 'GENERATION / FAMILY' 'BEST VM MODEL'
|
||||
printf ' %-16s %-42s %-34s %-14s\n' \
|
||||
'----------------' '------------------------------------------' \
|
||||
'----------------------------------' '--------------'
|
||||
|
||||
while IFS=$'\034' read -r node address host_max; do
|
||||
[[ -n "$node" ]] || continue
|
||||
|
||||
cpu_name="$(TAPM_NODE_CPU_NAME "$node" 2>/dev/null || true)"
|
||||
if [[ -n "$cpu_name" ]]; then
|
||||
generation="$(TAPM_CPU_GENERATION_FROM_NAME "$cpu_name")"
|
||||
else
|
||||
cpu_name='Unavailable'
|
||||
generation='Unavailable'
|
||||
fi
|
||||
|
||||
printf ' %-16.16s %-42.42s %-34.34s %-14s\n' \
|
||||
"$node" "$cpu_name" "$generation" "$host_max"
|
||||
done <<< "$host_rows"
|
||||
}
|
||||
|
||||
DETECT_CPU() {
|
||||
local answer
|
||||
local cpu_model
|
||||
@@ -1266,6 +1334,12 @@ DETECT_CPU() {
|
||||
return
|
||||
fi
|
||||
|
||||
TAPM_SHOW_CLUSTER_CPU_TABLE
|
||||
printf '\nRecommended cluster-wide VM CPU baseline: %s\n' "$cpu_model"
|
||||
printf '%s\n' \
|
||||
'This is the highest generic model shared by every node for HA placement,' \
|
||||
'load balancing, and moving workloads between cluster hosts.'
|
||||
|
||||
guest_output="$(TAPM_CLUSTER_QEMU_GUESTS)" || {
|
||||
echo -e "${idsCL[LightRed]}Could not read cluster QEMU resources.${idsCL[Default]}"
|
||||
FINISH_FAILED_ACTION
|
||||
@@ -1296,7 +1370,6 @@ DETECT_CPU() {
|
||||
return
|
||||
fi
|
||||
|
||||
printf '\nRecommended cluster CPU model: %s\n' "$cpu_model"
|
||||
printf '\n%-7s %-28s %-20s %-10s %-24s %s\n' \
|
||||
'VMID' 'NAME' 'NODE' 'TEMPLATE' 'CURRENT CPU' 'PROPOSED CPU'
|
||||
printf '%-7s %-28s %-20s %-10s %-24s %s\n' \
|
||||
@@ -1308,7 +1381,7 @@ DETECT_CPU() {
|
||||
"$vmid" "${name:-unnamed}" "$node" "$template" "$current_cpu" "$cpu_model"
|
||||
done
|
||||
|
||||
echo -en "\n${idsCL[LightCyan]}Apply this CPU model to ${#changes[@]} VM(s) and template(s) (y/N)?${idsCL[Default]} "
|
||||
echo -en "\n${idsCL[LightCyan]}Apply cluster-wide baseline ${cpu_model} to ${#changes[@]} VM(s) and template(s) (y/N)?${idsCL[Default]} "
|
||||
read -r -n 1 answer
|
||||
echo
|
||||
[[ "$answer" =~ ^[Yy]$ ]] || return
|
||||
@@ -2269,7 +2342,7 @@ HOST_SETUP_MENU() {
|
||||
values=("post_install")
|
||||
TAPM_POST_PROXMENUX_DETECTED &&
|
||||
labels[0]="TAPM Host Configuration — ProxMenux migration recommended"
|
||||
labels+=("Detect CPU model for live migrations")
|
||||
labels+=("Analyze VM CPU compatibility for HA and workload mobility")
|
||||
values+=("cpu")
|
||||
|
||||
# Discover ISO storage only after the VirtIO submenu is selected.
|
||||
|
||||
Reference in New Issue
Block a user