[ovirt-users] 回复: ovirt-engine-java-sdk-4.0: How fuzzy query
Ondra Machacek
omachace at redhat.com
Mon Aug 1 09:18:37 UTC 2016
On 08/01/2016 11:06 AM, 转圈圈 wrote:
> thanks.
> for example:
> List<Vm> vms =
> systemService.vmsService().list().search("search=name=myvm and
> status=up").send().vms();
> but I use query conditions "and" ,have no result.why?
Oh, sorry I meant you have to use 'search=' in case of using API,
so URL looks like: fqdn/ovirt-engine/api/vms?search=name=myvm and
status=down
But in case of using SDK, the 'search=' is created for you by 'search'
method, so
this should actually work for you:
Vm vm = systemService().vmsService.list().search("name=myvm and
status=up").send().vms().get(0);
>
>
>
> ------------------ 原始邮件 ------------------
> *发件人:* "Ondra Machacek";<omachace at redhat.com>;
> *发送时间:* 2016年8月1日(星期一) 下午4:37
> *收件人:* "转圈圈"<313922611 at qq.com>; "users"<users at ovirt.org>;
> *主题:* Re: [ovirt-users] ovirt-engine-java-sdk-4.0: How fuzzy query
>
> On 08/01/2016 07:13 AM, 转圈圈 wrote:
>> The above code is wrong,how fuzzy query?
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/users
>>
>
> You need to prefix with 'search=',
> So for example to search by name or status, you should have something like:
>
> ....list().search("search=name=myvm or status=up").send()....
>
> You can check examples here:
>
>
> https://github.com/oVirt/ovirt-engine-sdk-java/tree/master/sdk/src/test/java/org/ovirt/engine/sdk4/examples
More information about the Users
mailing list