[Engine-devel] Getting Hosts in a Data Center using the oVirt API

Michael Pasternak mpastern at redhat.com
Wed Jul 24 05:44:12 UTC 2013


Hi Dustin,

On 07/24/2013 01:35 AM, Schoenbrun, Dustin wrote:
> Hey Michael,
> 
> I had a question about what the best way of getting all hosts within a data center was using the oVirt Java API. Currently, we've been doing a "reverse lookup" from all
> hosts present in the oVirt Engine to see what clusters they're in and then finding out what data center the cluster belongs to. Thanks in advance, Michael!

Almost all root collections (such as hosts in your case), supports querying using
very same engine search dialect, so actually you can go to UI, combine query,
(use auto-completion) and use it in SDK, e.g:

List<Host> hosts = api.getHosts().list("datacenter = mydatacenter", null, null);

hope it helps.

> 
> -- Dustin
> 


-- 

Michael Pasternak
RedHat, ENG-Virtualization R&D



More information about the Devel mailing list