Solved

How to create a scheduled task in Prism

  • 7 July 2020
  • 3 replies
  • 912 views

Badge

Anyone know if it is possible to create a scheduled task in AHV to migrate a VM to another hosts in an AHV Cluster?

icon

Best answer by Sergei Ivanov 7 July 2020, 14:42

If you don’t put any target host, it will randomly select the target from the available hosts, like this:
 

acli vm.migrate <vm_name>

Regarding the cron job, it is enough to put it on one of the CVMs and it will execute the command on the time that you specify. Do not make it on every CVM. 

BTW, if you do an AOS upgrade, all non-default cron jobs will disappear.

View original

This topic has been closed for comments

3 replies

Userlevel 2
Badge +2

Hi GeoB,

from Prism it cannot be done, but if you log in to a CVM via SSH as user ‘nutanix’ you can create a crontab line to run the command to migrate your VM at your desired time:

acli vm.migrate <vm_name> host=<target_host_name>

 

Badge

Thanks for the help.  Is it possible to randomly select the target hosts, and can this cron job run from one hosts, and then be executed on all hosts in the cluster?

 

Thanks,

GeoB

Userlevel 2
Badge +2

If you don’t put any target host, it will randomly select the target from the available hosts, like this:
 

acli vm.migrate <vm_name>

Regarding the cron job, it is enough to put it on one of the CVMs and it will execute the command on the time that you specify. Do not make it on every CVM. 

BTW, if you do an AOS upgrade, all non-default cron jobs will disappear.