mirror of
https://github.com/gyptazy/ProxLB.git
synced 2026-04-05 20:31:57 +02:00
fix: limit to 10 requerys per a guest
This commit is contained in:
@@ -62,11 +62,13 @@ class Guests:
|
||||
# resource metrics for rebalancing to ensure that we do not overprovisiong the node.
|
||||
for guest in proxmox_api.nodes(node).qemu.get():
|
||||
if guest['status'] == 'running':
|
||||
while guest['cpu'] == 0:
|
||||
retry_counter = 1
|
||||
while guest['cpu'] == 0 and retry_counter < 10:
|
||||
guest = proxmox_api.nodes(node).qemu(guest['vmid']).status.current.get()
|
||||
logger.debug(f"guest {guest['name']} is reporting {
|
||||
guest['cpu']} cpu usage.")
|
||||
guest['cpu']} cpu usage on retry {retry_counter}.")
|
||||
time.sleep(1)
|
||||
retry_counter += 1
|
||||
guests['guests'][guest['name']] = {}
|
||||
guests['guests'][guest['name']]['name'] = guest['name']
|
||||
guests['guests'][guest['name']]['cpu_total'] = guest['cpus']
|
||||
|
||||
Reference in New Issue
Block a user