Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ parameters:
lxc_migration: OFF # Container migration (LXCs are rebooted during migration!!!)
migration_timeout: 1000 # For the future
only_on_master: OFF # Only run PLB on the current cluster master
dry_run: OFF # Dry run (don't balance)

# List of exclusions
exclusions:
Expand Down
5 changes: 5 additions & 0 deletions plb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
DRY_RUN = cfg["parameters"]["dry_run"]

"""Exclusions"""
excluded_vms = []
Expand Down Expand Up @@ -372,6 +373,10 @@ def vm_migration(variants: list, cluster_obj: object) -> None:
sys.exit(1)
donor, recipient, vm = variant[:3]
logger.debug(f'VM:{vm} migration from {donor} to {recipient}')
if DRY_RUN:
logger.info('DRY RUN, stop here.')
break

if vm in cluster_obj.cl_lxcs:
options = {'target': recipient, 'restart': 1}
url = f'{cluster_obj.server}/api2/json/nodes/{donor}/lxc/{vm}/migrate'
Expand Down