-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from gyptazy/release/v1.0.2
release: Prepare release v1.0.2
- Loading branch information
Showing
13 changed files
with
75 additions
and
23 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...on_to_run_only_on_cluster_master_node.yml → ...on_to_run_only_on_cluster_master_node.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
added: | ||
- Add option to run ProxLB only on the Proxmox's master node in the cluster. [40] | ||
- Add option to run ProxLB only on the Proxmox's master node in the cluster (reg. HA feature). [#40] |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fixed: | ||
- Fix CMake packaging for Debian package to avoid overwriting the config file. [#49] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
date: 2024-08-13 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
proxlb (1.0.2) unstable; urgency=low | ||
|
||
* Add option to run migration in parallel or sequentially. | ||
* Add option to run ProxLB only on a Proxmox cluster master (req. HA feature). | ||
* Fix daemon timer to use hours instead of minutes. | ||
* Fix CMake packaging for Debian package to avoid overwriting the config file. | ||
* Fix some wonkey code styles. | ||
|
||
-- Florian Paul Azim Hoberg <[email protected]> Tue, 13 Aug 2024 17:28:14 +0200 | ||
|
||
proxlb (1.0.0) unstable; urgency=low | ||
|
||
* Initial release of ProxLB. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
* Tue Aug 13 2024 Florian Paul Azim Hoberg <[email protected]> | ||
- Add option to run migration in parallel or sequentially. | ||
- Add option to run ProxLB only on a Proxmox cluster master (req. HA feature). | ||
- Fixed daemon timer to use hours instead of minutes. | ||
- Fixed some wonkey code styles. | ||
|
||
* Thu Aug 01 2024 Florian Paul Azim Hoberg <[email protected]> | ||
- Initial release of ProxLB. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/proxlb/proxlb.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ import urllib3 | |
|
||
# Constants | ||
__appname__ = "ProxLB" | ||
__version__ = "1.1.0b" | ||
__version__ = "1.0.2" | ||
__author__ = "Florian Paul Azim Hoberg <[email protected]> @gyptazy" | ||
__errors__ = False | ||
|
||
|
@@ -146,7 +146,7 @@ def __validate_config_file(config_path): | |
def initialize_args(): | ||
""" Initialize given arguments for ProxLB. """ | ||
argparser = argparse.ArgumentParser(description='ProxLB') | ||
argparser.add_argument('-c', '--config', type=str, help='Path to config file.', required=True) | ||
argparser.add_argument('-c', '--config', type=str, help='Path to config file.', required=False) | ||
argparser.add_argument('-d', '--dry-run', help='Perform a dry-run without doing any actions.', action='store_true', required=False) | ||
argparser.add_argument('-j', '--json', help='Return a JSON of the VM movement.', action='store_true', required=False) | ||
return argparser.parse_args() | ||
|
@@ -234,15 +234,29 @@ def api_connect(proxmox_api_host, proxmox_api_user, proxmox_api_pass, proxmox_ap | |
return api_object | ||
|
||
|
||
def execute_rebalancing_only_by_master(api_object, master_only): | ||
""" Validate if balancing should only be done by the cluster master. Afterwards, validate if this node is the cluster master. """ | ||
info_prefix = 'Info: [only-on-master-executor]:' | ||
master_only = bool(int(master_only)) | ||
|
||
if bool(int(master_only)): | ||
logging.info(f'{info_prefix} Master only rebalancing is defined. Starting validation.') | ||
cluster_master_node = get_cluster_master(api_object) | ||
cluster_master = validate_cluster_master(cluster_master_node) | ||
return cluster_master, master_only | ||
else: | ||
logging.info(f'{info_prefix} No master only rebalancing is defined. Skipping validation.') | ||
return False, master_only | ||
|
||
|
||
def get_cluster_master(api_object): | ||
""" Get the current master of the Proxmox cluster. """ | ||
error_prefix = 'Error: [cluster-master-getter]:' | ||
info_prefix = 'Info: [cluster-master-getter]:' | ||
|
||
logging.info(f'{info_prefix} Getting master node from cluster.') | ||
try: | ||
ha_status_object = api_object.cluster().ha().status().manager_status().get() | ||
logging.info(f'{info_prefix} Master node: {ha_status_object["manager_status"]["master_node"]}') | ||
logging.info(f'{info_prefix} Master node: {ha_status_object.get("manager_status", None).get("master_node", None)}') | ||
except urllib3.exceptions.NameResolutionError: | ||
logging.critical(f'{error_prefix} Could not resolve the API.') | ||
sys.exit(2) | ||
|
@@ -253,7 +267,13 @@ def get_cluster_master(api_object): | |
logging.critical(f'{error_prefix} SSL certificate verification failed for API.') | ||
sys.exit(2) | ||
|
||
return ha_status_object['manager_status']['master_node'] | ||
cluster_master = ha_status_object.get("manager_status", None).get("master_node", None) | ||
|
||
if cluster_master: | ||
return cluster_master | ||
else: | ||
logging.critical(f'{error_prefix} Could not obtain cluster master. Please check your configuration - stopping.') | ||
sys.exit(2) | ||
|
||
|
||
def validate_cluster_master(cluster_master): | ||
|
@@ -522,7 +542,7 @@ def balancing_calculations(balancing_method, balancing_mode, balancing_mode_opti | |
def __validate_balancing_method(balancing_method): | ||
""" Validate for valid and supported balancing method. """ | ||
error_prefix = 'Error: [balancing-method-validation]:' | ||
info_prefix = 'Info: [balancing-method-validation]]:' | ||
info_prefix = 'Info: [balancing-method-validation]:' | ||
|
||
if balancing_method not in ['memory', 'disk', 'cpu']: | ||
logging.error(f'{error_prefix} Invalid balancing method: {balancing_method}') | ||
|
@@ -534,7 +554,7 @@ def __validate_balancing_method(balancing_method): | |
def __validate_balancing_mode(balancing_mode): | ||
""" Validate for valid and supported balancing mode. """ | ||
error_prefix = 'Error: [balancing-mode-validation]:' | ||
info_prefix = 'Info: [balancing-mode-validation]]:' | ||
info_prefix = 'Info: [balancing-mode-validation]:' | ||
|
||
if balancing_mode not in ['used', 'assigned']: | ||
logging.error(f'{error_prefix} Invalid balancing method: {balancing_mode}') | ||
|
@@ -883,13 +903,12 @@ def main(): | |
|
||
# Get master node of cluster and ensure that ProxLB is only performed on the | ||
# cluster master node to avoid ongoing rebalancing. | ||
if bool(int(master_only)): | ||
cluster_master_node = get_cluster_master(api_object) | ||
cluster_master = validate_cluster_master(cluster_master_node) | ||
# Validate daemon service and skip following tasks when not being the cluster master. | ||
if not cluster_master: | ||
validate_daemon(daemon, schedule) | ||
continue | ||
cluster_master, master_only = execute_rebalancing_only_by_master(api_object, master_only) | ||
|
||
# Validate daemon service and skip following tasks when not being the cluster master. | ||
if not cluster_master and master_only: | ||
validate_daemon(daemon, schedule) | ||
continue | ||
|
||
# Get metric & statistics for vms and nodes. | ||
node_statistics = get_node_statistics(api_object, ignore_nodes) | ||
|