mirror of
https://github.com/gyptazy/ProxLB.git
synced 2026-04-05 20:31:57 +02:00
committed by
gyptazy
parent
d546036a9a
commit
d7631ef8f5
2
.changelogs/1.1.11/402_add_ha_job_validation.yml
Normal file
2
.changelogs/1.1.11/402_add_ha_job_validation.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
added:
|
||||
- Add HA job validation for migration jobs (@gytazy). [#402]
|
||||
@@ -226,8 +226,23 @@ class Balancing:
|
||||
logger.debug("Starting: get_rebalancing_job_status.")
|
||||
job = proxmox_api.nodes(guest_current_node).tasks(job_id).status().get()
|
||||
|
||||
# Fetch actual migration job status if this got spawned by a HA job
|
||||
if job["type"] == "hamigrate":
|
||||
logger.debug(f"Balancing: Job ID {job_id} (guest: {guest_name}) is a HA migration job. Fetching underlying migration job...")
|
||||
time.sleep(1)
|
||||
vm_id = int(job["id"])
|
||||
qm_migrate_jobs = proxmox_api.nodes(guest_current_node).tasks.get(typefilter="qmigrate", vmid=vm_id, start=0, source="active", limit=1)
|
||||
|
||||
if len(qm_migrate_jobs) > 0:
|
||||
job = qm_migrate_jobs[0]
|
||||
job_id = job["upid"]
|
||||
logger.debug(f'Overwriting job polling for: ID {job_id} (guest: {guest_name}) by {job}')
|
||||
else:
|
||||
logger.debug(f"Balancing: Job ID {job_id} (guest: {guest_name}) is a standard migration job. Proceeding with status check.")
|
||||
|
||||
# Watch job id until it finalizes
|
||||
if job["status"] == "running":
|
||||
# Note: Unsaved jobs are delivered in uppercase from Proxmox API
|
||||
if job.get("status", "").lower() == "running":
|
||||
# Do not hammer the API while
|
||||
# watching the job status
|
||||
time.sleep(10)
|
||||
|
||||
Reference in New Issue
Block a user