Bug 1252906

Summary: Search based on negated fields with null values doesn't work properly
Product: [oVirt] ovirt-engine Reporter: Yaniv Bronhaim <ybronhei>
Component: GeneralAssignee: Ravi Nori <rnori>
Status: CLOSED CURRENTRELEASE QA Contact: Lucie Leistnerova <lleistne>
Severity: medium Docs Contact:
Priority: low    
Version: ---CC: bugs, lleistne, lpeer, lsurette, lsvaty, michal.skrivanek, mperina, oourfali, rbalakri, Rhev-m-bugs, srevivo, tjelinek, ykaul
Target Milestone: ovirt-4.2.0Flags: rule-engine: ovirt-4.2+
rule-engine: planning_ack+
mperina: devel_ack+
lsvaty: testing_ack+
Target Release: 4.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-20 10:45:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yaniv Bronhaim 2015-08-12 13:31:53 UTC
el6.7 setup
oVirt Engine Version: 3.6.0-0.0.master.20150804111407.git122a3a0.el6

I added few vms and tried to search for custom_emulated_machine!=a, it returned empty list. Same for custom_cpu_type!=[any string I tried]

Expected results:
In my case - I should see all the vms that I added to my setup, none of them fits to custom_emulated_machine==a condition

Comment 1 Red Hat Bugzilla Rules Engine 2015-10-19 10:50:22 UTC
Target release should be placed once a package build is known to fix a issue. Since this bug is not modified, the target version has been reset. Please use target milestone to plan a fix for a oVirt release.

Comment 2 Sandro Bonazzola 2016-05-02 09:50:17 UTC
Moving from 4.0 alpha to 4.0 beta since 4.0 alpha has been already released and bug is not ON_QA.

Comment 3 Shahar Havivi 2017-01-09 10:07:38 UTC
The problem is not just in custom_emulated_machine, or custom_cpu_type but in any field that is nullable including the Vm.Description.

the search query build this sql query:
SELECT * FROM ((SELECT distinct vms.* FROM  vms   WHERE  vms.description  NOT ILIKE 'a' )  ORDER BY vm_name ASC ) as T1 OFFSET (1 -1) LIMIT 100;

any vm description that is null will not return since it should be Not/Is Null.

Comment 4 Shahar Havivi 2017-01-09 10:18:02 UTC
possible solution can be:
when using the 'NOT' in search we may be able to add "AND NOT NULL".
but need to see if it doesn't break other search behaviors.

Comment 7 Martin Perina 2017-01-10 12:24:47 UTC
Based on comment 3 we have an issue with all negated conditions applied to all fields containing null values. As we don't have any customer reports on that, it may not be used widely, so targeting to 4.2 and when patch is ready let's discuss backports

Comment 8 Lucie Leistnerova 2017-01-27 09:48:58 UTC
By testing shared storage/disk BZ 1320774 I run into problem with negative search.

Query - Storage: datacenter != Default and datacenter != dc2 - shared ISO storage is shown in result, but should not be.

Comment 9 Lucie Leistnerova 2017-09-01 13:17:57 UTC
Negative search in VMs works fine, but still searching of shared iso domain doesn't.

Steps to Reproduce:
1. Create two Data Centers dc1, dc2
2. Attach same ISO domain to both dc
3. search in Storage domains - datacenter != dc1 and datacenter != dc2

The iso domain is in the result but should not be.

tested in ovirt-engine-4.2.0-0.0.master.20170831223128.git34f4d69.el7.centos.noarch

Comment 10 Red Hat Bugzilla Rules Engine 2017-09-01 13:18:04 UTC
Target release should be placed once a package build is known to fix a issue. Since this bug is not modified, the target version has been reset. Please use target milestone to plan a fix for a oVirt release.

Comment 11 Lucie Leistnerova 2017-10-16 10:33:07 UTC
shared iso domain (shared disk too) is not displayed when searching with datacenter!=xx

verified in ovirt-engine-4.2.0-0.0.master.20171013142622.git15e767c.el7.centos.noarch

Comment 12 Sandro Bonazzola 2017-12-20 10:45:01 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.