Bug 1197074 - logical operators not working inside <disk> hostrequires
Summary: logical operators not working inside <disk> hostrequires
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: general
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: 20.2
Assignee: matt jia
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-27 13:06 UTC by Martin Frodl
Modified: 2018-02-06 00:41 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-07-14 08:04:45 UTC
Embargoed:


Attachments (Terms of Use)

Description Martin Frodl 2015-02-27 13:06:47 UTC
Description of problem:

Using common sense (and also a little bit of Beaker XML description grammar [0]), the following three commands should behave precisely in the same way, i.e. list all the systems whose disks begin with "AIX":

$ bkr list-systems --available --xml='<hostRequires><disk><model op="like" value="AIX%" /></disk></hostRequires>'
$ bkr list-systems --available --xml='<hostRequires><disk><or><model op="like" value="AIX%" /></or></disk></hostRequires>'
$ bkr list-systems --available --xml='<hostRequires><disk><and><model op="like" value="AIX%" /></and></disk></hostRequires>'

In fact, only the first command does what it should. In the latter two cases, the whole <and>...</and>, resp. <or>...</or> block seems to have been completely ignored:

$ bkr list-systems --available --xml='<hostRequires><disk><model op="like" value="AIX%" /></disk></hostRequires>' | wc -l
95
$ bkr list-systems --available --xml='<hostRequires><disk><and><model op="like" value="AIX%" /></and></disk></hostRequires>' | wc -l
624
$ bkr list-systems --available --xml='<hostRequires><disk><or><model op="like" value="AIX%" /></or></disk></hostRequires>' | wc -l
624

What's inside the <and>/<or> block doesn't matter; replacing <model> with <size> produced analogous results. On the other hand, the same does not hold for other tags in place of <disk>; for instance, the outputs of the following three commands were identical:

$ bkr list-systems --available --xml='<hostRequires><cpu><model_name op="like" value="AMD%"/></cpu></hostRequires>' | wc -l
27
$ bkr list-systems --available --xml='<hostRequires><cpu><and><model_name op="like" value="AMD%"/></and></cpu></hostRequires>' | wc -l
27
$ bkr list-systems --available --xml='<hostRequires><cpu><or><model_name op="like" value="AMD%"/></or></cpu></hostRequires>' | wc -l
27


External links:
[0] https://beaker-project.org/docs/_downloads/beaker-job.rng

Comment 1 Dan Callaghan 2015-03-26 08:16:48 UTC
I don't think we ever considered this scenario before (using <and/> and <or/> inside <disk/> and <cpu/>). It should be easy enough to implement.

Comment 2 matt jia 2015-05-12 01:05:03 UTC
(In reply to Dan Callaghan from comment #1)
> I don't think we ever considered this scenario before (using <and/> and
> <or/> inside <disk/> and <cpu/>). It should be easy enough to implement.

We have this scenario in <cpu/> but not in <disk/>. On gerrit:

http://gerrit.beaker-project.org/#/c/4208/

Comment 4 matt jia 2015-06-16 00:35:32 UTC
Verified steps:

As shown in comment 0, use the following commands to check if logical operators
are working inside <disk> hostrequires.

$ bkr list-systems --available --xml='<hostRequires><disk><model op="like" value="Mega%" /></disk></hostRequires>' | wc -l
3
$ bkr list-systems --available --xml='<hostRequires><disk><and><model op="like" value="Mega%" /></and></disk></hostRequires>' | wc -l
3
$ bkr list-systems --available --xml='<hostRequires><disk><or><model op="like" value="Mega%" /></or></disk></hostRequires>' | wc -l
3

Comment 6 Dan Callaghan 2015-07-14 08:04:45 UTC
Beaker 20.2 has been released.


Note You need to log in before you can comment on or make changes to this bug.