diff --git a/proxlb/models/guests.py b/proxlb/models/guests.py index fd61d89..2e143b3 100644 --- a/proxlb/models/guests.py +++ b/proxlb/models/guests.py @@ -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']