Ovirt : How to shutdown/stop or start virtual machines (VMs) in ovirt DC automatically using python/ovirt- sdk ? [Part 1]

Recently I got a request to provide a python program to shutdown all the vms in ovirt DC using python-sdk and also to start Vms in the DC. Below program is submitted as a quick solution.. Sharing it here hoping it will help you.

To shutdown all the VMs in a ovirt Data Center, you can try below program called ‘shutdown_all_up_vms.py’ . You need to configure below parameters in the program depending on your setup :

Programs can be downloaded from here .

Here is the copy of the program:

Another program ( almost replica) is available for ‘start’ vms (start_all_down_vms.py ) as well.. You can download it from github.com/humblec/python-sdk-ovirt

If you execute any of above program, the console output may look like this:

As you can see above, the program logged better inside ‘/tmp/start_vms_dc.log’

2 thoughts on “Ovirt : How to shutdown/stop or start virtual machines (VMs) in ovirt DC automatically using python/ovirt- sdk ? [Part 1]”

  1. Hi all,
    be carefull because method vmObj.stop makes a power off, change it with vmObj.shutdown to procede with a regular shutdown.
    Bye
    Enrico

Leave a Reply

Your email address will not be published. Required fields are marked *