Skip to content

Commit

Permalink
feat(node): nodeevacuate add --wait flag
Browse files Browse the repository at this point in the history
  • Loading branch information
paullaffitte authored and lcaflc committed Nov 19, 2024
1 parent 8b8f1f1 commit edae9da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/pvecontrol/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def _parser():
parser_nodeevacuate.add_argument('--node', action='store', required=True, help="Node to evacuate")
parser_nodeevacuate.add_argument('--target', action='append', required=False, help="Destination Proxmox VE node, you can specify multiple target options")
parser_nodeevacuate.add_argument('-f', '--follow', action='store_true', help="Follow task log output")
parser_nodeevacuate.add_argument('-w', '--wait', action='store_true', help="Wait task end")
parser_nodeevacuate.add_argument('--online', action='store_true', help="Online migrate the VM, default True", default=True)
parser_nodeevacuate.add_argument('--no-skip-stopped', action='store_true', help="Don't skip VMs that are stopped")
parser_nodeevacuate.add_argument('--dry-run', action='store_true', help="Dry run, do not execute migration")
Expand Down
11 changes: 2 additions & 9 deletions src/pvecontrol/actions/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,9 @@ def action_nodeevacuate(proxmox, args):
logging.debug("Migration UPID: %s"%upid)
proxmox.refresh()
task = proxmox.find_task(upid)
if args.follow:
print_task(proxmox, upid, args.follow)
if args.follow or args.wait:
print_task(proxmox, upid, args.follow, args.wait)
else:
print_taskstatus(task)
# wait for task completion
while task.running():
logging.debug("Task status: %s", task.runningstatus)
task.refresh()
time.sleep(1)
print_taskstatus(task)

else:
print("Dry run, skipping migration")

0 comments on commit edae9da

Please sign in to comment.