Merge pull request #269 from gyptazy/fix/268-evaluate-balancing-types

fix: Fix balancing evaluation of guest types (e.g., VM or CT).
This commit is contained in:
Florian
2025-07-17 11:44:29 +02:00
committed by GitHub
3 changed files with 17 additions and 2 deletions

View File

@@ -0,0 +1,2 @@
fixed:
- Fix balancing evaluation of guest types (e.g., VM or CT) (@gyptazy). [#268]

View File

@@ -0,0 +1 @@
date: TBD

View File

@@ -90,11 +90,23 @@ class Balancing:
# VM Balancing
if guest_meta["type"] == "vm":
job_id = self.exec_rebalancing_vm(proxmox_api, proxlb_data, guest_name)
if 'vm' in proxlb_data["meta"]["balancing"].get("balance_types", []):
logger.debug("Balancing: Balancing for guest {guest_name} of type VM started.")
job_id = self.exec_rebalancing_vm(proxmox_api, proxlb_data, guest_name)
else:
logger.debug(
f"Balancing: Balancing for guest {guest_name} will not be performed. "
"Guest is of type VM which is not included in allowed balancing types.")
# CT Balancing
elif guest_meta["type"] == "ct":
job_id = self.exec_rebalancing_ct(proxmox_api, proxlb_data, guest_name)
if 'ct' in proxlb_data["meta"]["balancing"].get("balance_types", []):
logger.debug("Balancing: Balancing for guest {guest_name} of type CT started.")
job_id = self.exec_rebalancing_ct(proxmox_api, proxlb_data, guest_name)
else:
logger.debug(
f"Balancing: Balancing for guest {guest_name} will not be performed. "
"Guest is of type CT which is not included in allowed balancing types.")
# Just in case we get a new type of guest in the future
else: