diff --git a/.changelogs/1.1.11/408_fix_moving_ignored_guests.yml b/.changelogs/1.1.11/408_fix_moving_ignored_guests.yml new file mode 100644 index 0000000..3deb681 --- /dev/null +++ b/.changelogs/1.1.11/408_fix_moving_ignored_guests.yml @@ -0,0 +1,2 @@ +fixed: + - Fixed that ignored VMs/CTs got moved to another node when being ignored (@gyptazy). [#408] diff --git a/proxlb/models/calculations.py b/proxlb/models/calculations.py index 5295abf..b7f978f 100644 --- a/proxlb/models/calculations.py +++ b/proxlb/models/calculations.py @@ -580,8 +580,11 @@ class Calculations: proxlb_data["nodes"][node_current]["disk_used_percent"] = proxlb_data["nodes"][node_current]["disk_used"] / proxlb_data["nodes"][node_current]["disk_total"] * 100 # Assign guest to the new target node - proxlb_data["guests"][guest_name]["node_target"] = node_target - logger.debug(f"Set guest {guest_name} from node {node_current} to node {node_target}.") + if not proxlb_data["guests"][guest_name]["ignore"]: + proxlb_data["guests"][guest_name]["node_target"] = node_target + logger.debug(f"Set guest {guest_name} from node {node_current} to node {node_target}.") + else: + logger.debug(f"Guest {guest_name} is marked as ignored. Skipping target node assignment.") logger.debug("Finished: update_node_resources.") diff --git a/proxlb/models/tags.py b/proxlb/models/tags.py index f02bf36..0b6dd07 100644 --- a/proxlb/models/tags.py +++ b/proxlb/models/tags.py @@ -107,7 +107,7 @@ class Tags: logger.debug(f"Adding affinity group for tag {tag}.") affinity_tags.append(tag) else: - logger.debug(f"Skipping affinity group for tag {tag}.") + logger.debug(f"Skipping evaluation of tag: {tag} This is not an affinity tag.") # Pool based affinity groups if len(pools) > 0: @@ -117,7 +117,7 @@ class Tags: logger.debug(f"Adding affinity group for pool {pool}.") affinity_tags.append(pool) else: - logger.debug(f"Skipping affinity group for pool {pool}.") + logger.debug(f"Skipping evaluation of pool: {pool} This is not an affinity pool.") # HA rule based affinity groups if len(ha_rules) > 0: @@ -157,7 +157,7 @@ class Tags: logger.debug(f"Adding anti-affinity group for tag {tag}.") anti_affinity_tags.append(tag) else: - logger.debug(f"Skipping anti-affinity group for tag {tag}.") + logger.debug(f"Skipping evaluation of tag: {tag} This is not an anti-affinity tag.") # Pool based anti-affinity groups if len(pools) > 0: @@ -167,7 +167,7 @@ class Tags: logger.debug(f"Adding anti-affinity group for pool {pool}.") anti_affinity_tags.append(pool) else: - logger.debug(f"Skipping anti-affinity group for pool {pool}.") + logger.debug(f"Skipping evaluation of pool: {pool} This is not an anti-affinity pool.") # HA rule based anti-affinity groups if len(ha_rules) > 0: @@ -197,9 +197,14 @@ class Tags: ignore_tag = False if len(tags) > 0: + logger.debug(f"Found {len(tags)} tags to evaluate.") for tag in tags: + logger.debug(f"Evaluating tag: {tag}.") if tag.startswith("plb_ignore"): + logger.debug(f"Found valid ignore tag: {tag}. Marking guest as ignored.") ignore_tag = True + else: + logger.debug(f"Tag: {tag} This is not an ignore tag.") logger.debug("Finished: get_ignore.") return ignore_tag