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

--_000_CE147D80D9B0dustinschoenbrunnetappcom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 "revers= e lookup" from all hosts present in the oVirt Engine to see what clusters t= hey're in and then finding out what data center the cluster belongs to. Tha= nks in advance, Michael! -- Dustin --_000_CE147D80D9B0dustinschoenbrunnetappcom_ Content-Type: text/html; charset="us-ascii" Content-ID: <B3BCD3481914DD4A954C01CE14D8DF57@hq.netapp.com> Content-Transfer-Encoding: quoted-printable <html> <head> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
</head> <body style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-lin= e-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-fami= ly: Calibri, sans-serif; "> <div> <div> <div>Hey Michael,</div> <div><br> </div> <div>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 &q= uot;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!</= div> <div><br> </div> <div> <div>-- Dustin</div> <div><br> </div> </div> </div> </div> </body> </html> --_000_CE147D80D9B0dustinschoenbrunnetappcom_--

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

Hey Michael, That's really helpful! I didn't know you could use queries like in the search bar within the API. Thanks for the help! -- Dustin On 7/24/13 1:44 AM, "Michael Pasternak" <mpastern@redhat.com> wrote:
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
participants (2)
-
Michael Pasternak
-
Schoenbrun, Dustin