Solved

How to create a scheduled task in Prism

  • 7 July 2020
  • 3 replies
  • 2150 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

View original

This topic has been closed for comments

3 replies

Userlevel 4
Badge +5

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 4
Badge +5

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.