oVirt API allows faster and simple development of scripts and utilities ranging from gathering of information to VM/host, etc manipulation.
For example, a simple script for connecting to API and list VM’s could be:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
.list() method works pretty well, but beware, it limits collections to 100 elements for performance reasons, so in those cases, we’ll need to check how many results do we have, and paginate by passing an extra argument to our “.list()” invocation, for example:
Furthermore, we can check the number of results by using:
And playing together, we could set a list that returns all results by running:
1 2 3 4 5 6 7 8 9 10
We can also make funny things like migrate VM’s to another host by just running:
It’s expected for RHEV 3.1 to have a developer guide (now in Beta) at https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Virtualization/3.1-Beta/html-single/Developer_Guide/index.html
Check it for more examples of use and put the Virtualization to work for you!