Skip to content

Commit efdb635

Browse files
committed
feature: Add new option to enforce node/guest pinning even when cluster is balanced from a resource perspective.
Fixes: #414
1 parent da193f9 commit efdb635

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
added:
2+
- Add new option to enforce node/guest pinning even when cluster is balanced from a resource perspective (@gyptazy). [#414]

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ The following options can be set in the configuration file `proxlb.yaml`:
289289
| | overprovisioning | | False | `Bool` | Avoids balancing when nodes would become overprovisioned. |
290290
| `balancing` | | | | | |
291291
| | enable | | True | `Bool` | Enables the guest balancing.|
292-
| | enforce_affinity | | True | `Bool` | Enforcing affinity/anti-affinity rules but balancing might become worse. |
292+
| | enforce_affinity | | False | `Bool` | Enforcing affinity/anti-affinity rules but balancing might become worse. |
293+
| | enforce_pinning | | False | `Bool` | Enforcing pinning rules but balancing might become worse. |
293294
| | parallel | | False | `Bool` | If guests should be moved in parallel or sequentially.|
294295
| | parallel_jobs | | 5 | `Int` | The amount if parallel jobs when migrating guests. (default: `5`)|
295296
| | live | | True | `Bool` | If guests should be moved live or shutdown.|
@@ -340,6 +341,7 @@ proxmox_cluster:
340341
balancing:
341342
enable: True
342343
enforce_affinity: False
344+
enforce_pinning: False
343345
parallel: False
344346
live: True
345347
with_local_disks: True

‎config/proxlb_example.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ proxmox_cluster:
1919
balancing:
2020
enable: True
2121
enforce_affinity: False
22+
enforce_pinning: False
2223
parallel: False
2324
# If running parallel job, you can define
2425
# the amount of prallel jobs (default: 5)

‎proxlb/models/calculations.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,12 @@ def relocate_guests(proxlb_data: Dict[str, Any]):
369369
None
370370
"""
371371
logger.debug("Starting: relocate_guests.")
372-
if proxlb_data["meta"]["balancing"]["balance"] or proxlb_data["meta"]["balancing"].get("enforce_affinity", False):
372+
373+
# Balance only if it is required by:
374+
# - balanciness
375+
# - Affinity/Anti-Affinity rules
376+
# - Pinning rules
377+
if proxlb_data["meta"]["balancing"]["balance"] or proxlb_data["meta"]["balancing"].get("enforce_affinity", False) or proxlb_data["meta"]["balancing"].get("enforce_pinning", False):
373378

374379
if proxlb_data["meta"]["balancing"].get("balance", False):
375380
logger.debug("Balancing of guests will be performed. Reason: balanciness")

0 commit comments

Comments
 (0)