Bug 1197074

Summary: logical operators not working inside <disk> hostrequires
Product: [Retired] Beaker Reporter: Martin Frodl <mfrodl>
Component: generalAssignee: matt jia <mjia>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: aigao, asaha, dcallagh, dowang, mjia
Target Milestone: 20.2Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-14 08:04:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.