Thist python script balance virtual machine (VM) on different host, balance is simple and is based on VM name with at the end a numerical identification; for example we can have VMPROJ1PROD01 and is counterpart VMPROJ1PROD02, we suppose that this two VMs are related to the same project / application, and them is balanced by other device (haproxy, varnish, F5, cluster suite...), so to ensure it's availability we want to run them on different host, like new feature Negative Affinity group:
http://www.ovirt.org/Features/VM-Affinity
but this simple script tries to apply this negative affinity on ALL VMs that has same VM name with different progressive number, and most important it tries to migrate only the even VM -> for above VM example, if VMPROJ1PROD01 and VMPROJ1PROD02 are running on the same host, this script will migrate only VM VMPROJ1PROD02.
If you would like to ignore some VM, you can put them on txt file and pass that file with option --vmignore.
Example of usage:
/root/script/BalanceVMOnDifferentHost/BalanceVMOnDifferentHost.py --authfile /root/DR/.authpass --datacenter NO_PROD --vmignore /root/script/BalanceVMOnDifferentHost/ignorevm-test.txt