[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-API] get_all_records_where

Hi Randy,

Could you try something like this:

VM.get_all_records_where('field "tags" = "(\'test2\' \'test\')"')

Look in /var/log/state.db, where xapi keeps a copy of its database in XML 
format, for examples of how complicated values such as sets and maps are 
encoded in the database.

The *_where calls are indeed not documented, and the main reason is that we 
were never happy about the syntax (as you can imagine)...


> -----Original Message-----
> From: xen-api-bounces@xxxxxxxxxxxxx [mailto:xen-api-
> bounces@xxxxxxxxxxxxx] On Behalf Of Randy
> Sent: 20 February 2013 1:42 AM
> To: xen-api@xxxxxxxxxxxxx
> Subject: [Xen-API] get_all_records_where
> I'm trying to better understand the 'where' expression parameter on
> this API call.   I can't seem to find any documentation in the API
> manual, nor any practical examples floating around the net or in example
> scripts.   My attempts at deciphering the xen-api source code are
> failing miserably.
> For basic scenario like this (the only one I could find on the net), it makes
> sense:
> VM.get_all_records_where('field "is_a_template" = "true" and field
> "is_a_snapshot" = "false"')
> But I'd like to lust VM's only with particular tags.  Like this, but via XAPI
> instead:
> xe vm-list tags="test2, test"
> In xensource.log you can see that get_all_records_where is called, but the
> parameter info is redacted:
> Feb 19 20:37:23 cl-ash-h1 xapi: [debug|cl-ash-h1|10922153 UNIX
> /var/xapi/xapi|dispatch:VM.get_all_records_where
> D:c2dbcc791f62|api_readonly] VM.get_all_records_where
> Is there any way I can debug the call parameters so I can run the same
> command from my scripts?  Or can someone clue me in on an expression
> that would work with the tags (array style) field?
> --
> ~Randy
> _______________________________________________
> Xen-api mailing list
> Xen-api@xxxxxxxxxxxxx
> http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api

Xen-api mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.