mirror of
https://github.com/gyptazy/ProxLB.git
synced 2026-04-06 04:41:58 +02:00
Merge pull request #202 from glitchvern/fix/200-requery-zero-guest-cpu-used2
fix: Requery a guest if that running guest reports 0 cpu usage
This commit is contained in:
2
.changelogs/1.1.1/200_requery_zero_guest_cpu_used.yml
Normal file
2
.changelogs/1.1.1/200_requery_zero_guest_cpu_used.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
fixed:
|
||||
- Requery a guest if that running guest reports 0 cpu usage (by @glitchvern) [#200]
|
||||
@@ -11,6 +11,7 @@ __license__ = "GPL-3.0"
|
||||
from typing import Dict, Any
|
||||
from utils.logger import SystemdLogger
|
||||
from models.tags import Tags
|
||||
import time
|
||||
|
||||
logger = SystemdLogger()
|
||||
|
||||
@@ -61,6 +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':
|
||||
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 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