How to create a scheduled task in Prism | Nutanix Community
Skip to main content

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

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>

 


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


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.