[ovirt-users] Shutdown all VM's command line

Kapetanakis Giannis bilias at edu.physics.uoc.gr
Thu Jan 11 10:44:26 UTC 2018


On 10/01/18 22:11, Wesley Stewart wrote:
> Marcelo,
> 
> I would greatly appreciate seeing a script!  It would be an excellent chance for me to learn a bit about using ovirt from the command line as well!

I'm using something like this with ovirt-shell

vm_shutdown:
#!/bin/sh
LOG=/root/ovirt/vm_shutdown_log
echo `date` >> $LOG
/usr/bin/ovirt-shell -f /root/ovirt/vm_shutdown_script >> $LOG
echo "" >> $LOG

vm_shutdown_script:
list vms --kwargs status-state=up|grep name | sed s/'name       :'/'action vm'/ | sed -e 's/$/ shutdown/' > /root/ovirt/new_vm_shutdown_script
file /root/ovirt/new_vm_shutdown_script

new_vm_shutdown_script now lists entries like this:
action vm vm1 shutdown
action vm vm2 shutdown
etc.

G




More information about the Users mailing list