Merge branch 'main' into feature/auto-node-upgrade

This commit is contained in:
Florian Paul Azim Hoberg
2024-08-07 13:12:24 +02:00
6 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
added:
- Add option to run ProxLB only on the Proxmox's master node in the cluster. [40]

View File

@@ -0,0 +1,2 @@
added:
- Add option to run migrations in parallel or sequentially. [#41]

View File

@@ -0,0 +1,2 @@
changed:
- Fix daemon timer to use hours instead of minutes. [#45]

View File

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

View File

@@ -109,8 +109,10 @@ The following options can be set in the `proxlb.conf` file:
| mode_option | byte | Rebalance by node's resources in `bytes` or `percent`. (default: bytes) |
| type | vm | Rebalance only `vm` (virtual machines), `ct` (containers) or `all` (virtual machines & containers). (default: vm)|
| balanciness | 10 | Value of the percentage of lowest and highest resource consumption on nodes may differ before rebalancing. (default: 10) |
| parallel_migrations | 1 | Defines if migrations should be done parallely or sequentially. (default: 1) |
| ignore_nodes | dummynode01,dummynode02,test* | Defines a comma separated list of nodes to exclude. |
| ignore_vms | testvm01,testvm02 | Defines a comma separated list of VMs to exclude. (`*` as suffix wildcard or tags are also supported) |
| master_only | 0 | Defines is this should only be performed (1) on the cluster master node or not (0). (default: 0) |
| daemon | 1 | Run as a daemon (1) or one-shot (0). (default: 1) |
| schedule | 24 | Hours to rebalance in hours. (default: 24) |
| log_verbosity | INFO | Defines the log level (default: CRITICAL) where you can use `INFO`, `WARN` or `CRITICAL` |
@@ -133,9 +135,16 @@ type: vm
# Rebalancing: node01: 41% memory consumption :: node02: 52% consumption
# No rebalancing: node01: 43% memory consumption :: node02: 50% consumption
balanciness: 10
# Enable parallel migrations. If set to 0 it will wait for completed migrations
# before starting next migration.
parallel_migrations: 1
ignore_nodes: dummynode01,dummynode02
ignore_vms: testvm01,testvm02
[service]
# The master_only option might be usuful if running ProxLB on all nodes in a cluster
# but only a single one should do the balancing. The master node is obtained from the Proxmox
# HA status.
master_only: 0
daemon: 1
```

6
proxlb
View File

@@ -272,6 +272,7 @@ def validate_cluster_master(cluster_master):
return True
<<<<<<< HEAD
def get_node_update_status(api_object):
""" Get the current update status of the current executing host node in the cluster. """
info_prefix = 'Info: [node-update-status-getter]:'
@@ -360,6 +361,8 @@ def run_node_reboot(api_object, node_requires_reboot):
logging.info(f'{info_prefix} Rebooting node now: {node_executor_hostname}.')
=======
>>>>>>> main
def get_node_statistics(api_object, ignore_nodes):
""" Get statistics of cpu, memory and disk for each node in the cluster. """
info_prefix = 'Info: [node-statistics]:'
@@ -984,6 +987,7 @@ def main():
validate_daemon(daemon, schedule)
continue
<<<<<<< HEAD
# Validate for node auto update in cluster for rolling updates.
# Note: This requires proxlb-additions with a patched Proxmox API!
#rolling_updates = 1
@@ -994,6 +998,8 @@ def main():
if node_requires_reboot:
ignore_nodes = extend_ignore_node_list(ignore_nodes)
=======
>>>>>>> main
# Get metric & statistics for vms and nodes.
node_statistics = get_node_statistics(api_object, ignore_nodes)
vm_statistics = get_vm_statistics(api_object, ignore_vms, balancing_type)