Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trivial patch to disable looping (for crond) #35

Open
kjj2 opened this issue May 21, 2024 · 0 comments
Open

Trivial patch to disable looping (for crond) #35

kjj2 opened this issue May 21, 2024 · 0 comments

Comments

@kjj2
Copy link

kjj2 commented May 21, 2024

This patch adds loop to the parameters section of the config file. If this is not set, or set to Off, the script will exit at the end of a balancing run. This is useful if you want to avoid having the load balancer run while (for example) backups are running.

--- plb.py      2024-05-21 04:56:39.802275066 -0500
+++ plb-loop_option.py   2024-05-21 04:52:25.979306790 -0500
@@ -32,6 +32,7 @@
 LXC_MIGRATION = cfg["parameters"]["lxc_migration"]
 MIGRATION_TIMEOUT = cfg["parameters"]["migration_timeout"]
 ONLY_ON_MASTER = cfg["parameters"].get("only_on_master", False)
+LOOP = cfg["parameters"].get("loop", False)

 """Exclusions"""
 excluded_vms = []
@@ -485,9 +574,13 @@
             sleep(60)
             pass  # TODO Aggressive algorithm
     else:
-        logger.info('The cluster is balanced. Waiting 300 seconds.')
-        iteration += 1
-        sleep(300)
+        if LOOP:
+            logger.info('The cluster is balanced. Waiting 300 seconds.')
+            iteration += 1
+            sleep(300)
+        else:
+            logger.info('Looping not enabled.  exiting.')
+            sys.exit(0)


 while True:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant