fixed HA VM timeout during mm

This commit is contained in:
2026-07-26 22:01:55 -05:00
parent dcccb8d837
commit 8c73cb7a53
3 changed files with 45 additions and 5 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
action="${1:-}" action="${1:-}"
FOLDER='/opt/idssys/ta-proxmenu' FOLDER='/opt/idssys/ta-proxmenu'
VERS='2026.7.26-8' VERS='2026.7.26-9'
noupdate=' ' noupdate=' '
+13 -4
View File
@@ -455,6 +455,9 @@ wait_for_ha_evacuation() {
local -a ha_ids local -a ha_ids
local -a remaining local -a remaining
local guest local guest
local guest_status
local guest_type
local guest_vmid
local ha_id local ha_id
log "Waiting for HA-managed guests to leave ${LOCAL_NODE}." log "Waiting for HA-managed guests to leave ${LOCAL_NODE}."
@@ -471,8 +474,10 @@ wait_for_ha_evacuation() {
remaining=() remaining=()
for guest in "${local_guests[@]}"; do for guest in "${local_guests[@]}"; do
IFS=$'\x1f' read -r guest_vmid guest_type guest_status _ <<< "$guest"
[[ "$guest_status" == "running" ]] || continue
for ha_id in "${ha_ids[@]}"; do for ha_id in "${ha_ids[@]}"; do
if [[ "${guest%%$'\x1f'*}" == "$ha_id" ]]; then if [[ "$guest_vmid" == "$ha_id" ]]; then
remaining+=("$guest") remaining+=("$guest")
break break
fi fi
@@ -842,9 +847,13 @@ main() {
policy_nodes policy_strict policy_rule destination route_note <<< "$guest" policy_nodes policy_strict policy_rule destination route_note <<< "$guest"
if guest_is_ha_managed "$vmid"; then if guest_is_ha_managed "$vmid"; then
warn "${guest_type} ${vmid} became HA-managed; TAPM will not migrate it manually." status="$(guest_status "$vmid" "$guest_type")"
migration_skipped+=("$guest") if [[ "$status" != "stopped" ]]; then
continue warn "${guest_type} ${vmid} is HA-managed and is not confirmed stopped; TAPM will not migrate it manually."
migration_skipped+=("$guest")
continue
fi
log "${guest_type} ${vmid} is HA-managed but stopped; continuing with offline migration."
fi fi
if ! choose_destination "$required_storages" "$policy_nodes" "$policy_strict"; then if ! choose_destination "$required_storages" "$policy_nodes" "$policy_strict"; then
+31
View File
@@ -5,6 +5,37 @@ TEST_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "${TEST_ROOT}/tests/testlib.sh" source "${TEST_ROOT}/tests/testlib.sh"
source "${TEST_ROOT}/inc/evacuate-proxmox-node.sh" source "${TEST_ROOT}/inc/evacuate-proxmox-node.sh"
test_stopped_ha_guest_does_not_block_wait() {
LOCAL_NODE=node1
HA_WAIT_SECONDS=0
get_local_guests() {
printf '%s\n' \
$'100\x1fqemu\x1fstopped\x1fshutdown-ha-vm\x1f1024' \
$'101\x1fqemu\x1frunning\x1fnon-ha-vm\x1f1024'
}
get_ha_guest_ids() {
printf '%s\n' 100
}
wait_for_ha_evacuation
}
test_running_ha_guest_blocks_wait() {
LOCAL_NODE=node1
HA_WAIT_SECONDS=0
get_local_guests() {
printf '%s\n' $'100\x1fqemu\x1frunning\x1frunning-ha-vm\x1f1024'
}
get_ha_guest_ids() {
printf '%s\n' 100
}
wait_for_ha_evacuation
}
assert_success "stopped HA guest does not block evacuation wait" \
test_stopped_ha_guest_does_not_block_wait
assert_failure "running HA guest still blocks evacuation wait" \
test_running_ha_guest_blocks_wait
set_routing_fixture() { set_routing_fixture() {
MIGRATION_NODES=(node2 node3) MIGRATION_NODES=(node2 node3)
NODE_STORAGE_CACHE=() NODE_STORAGE_CACHE=()