Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 1519541

Summary: log-collector-analyzer: ERROR: column v.agent_ip does not exist
Product: [oVirt] ovirt-log-collector Reporter: Douglas Schilling Landgraf <dougsland>
Component: analyzerAssignee: Ala Hino <ahino>
Status: CLOSED CURRENTRELEASE QA Contact: David Necpal <dnecpal>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.2.0CC: ahino, bugs, dougsland, lsvaty, lveyde, ylavi
Target Milestone: ovirt-4.2.2Flags: rule-engine: ovirt-4.2+
rule-engine: exception+
dnecpal: testing_plan_complete-
ylavi: planning_ack+
sbonazzo: devel_ack+
lsvaty: testing_ack+
Target Release: 4.2.3   
Hardware: All   
OS: All   
Fixed In Version: ovirt-log-collector-4.2.3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-29 11:12:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1456888    

Description Douglas Schilling Landgraf 2017-11-30 21:11:47 UTC
The column agent_ip has changed name, we require to fix analyzer for recent db (4.2).

Generating reports:
psql:/usr/share/ovirt-log-collector/analyzer/produceReport/sqls/hosts_query_all.sql:137: ERROR:  column v.agent_ip does not exist
LINE 8:             v.agent_ip AS "Agent IP",
            v.vds_name AS "Name of Host",
            CASE WHEN sp.spm_vds_id=v.vds_id THEN 'SPM' ELSE 'Normal' END AS "SPM",
            coalesce(htt.text, 'Unknown (id='||v.vds_type||')') AS "Host Type",
   AS "Cluster",
   AS "Data Center",
            v.agent_ip AS "Agent IP",
            v.host_name AS "FQDN or IP",
            regexp_replace(v.rpm_version, '[a-z]+.', '') AS "vdsm",
            v.kvm_version AS "qemu-kvm",
            regexp_replace(v.libvirt_version, '[a-z]+.', '') AS "libvirt",
            v.spice_version AS "spice",
            v.kernel_version AS "kernel",
            hst.text AS "Status",
            v.host_os AS "Operating System",
            v.vm_count AS "VM Count",
            v.mem_available AS "Available memory (MB)",
            v.usage_mem_percent AS "Used memory %",
            v.usage_cpu_percent AS "CPU load %"
            vds v
        JOIN cluster c ON c.cluster_id=v.cluster_id
        LEFT OUTER JOIN storage_pool sp ON c.storage_pool_id =
        LEFT OUTER JOIN host_status_temp hst ON = v.status
        LEFT OUTER JOIN host_type_temp htt ON = v.vds_type
        ORDER BY, v.vds_name
CONTEXT:  PL/pgSQL function __temp_hosts_show_all() line 20 at RETURN QUERY
Generated analyzer_report.html

Comment 1 Douglas Schilling Landgraf 2017-12-12 15:54:45 UTC
Just a hint from: 

    -- We might have cases where engine db's like 3.2, 3.3, 3.4, 3.5 have
    -- vds table with column ip and 3.6 or later with column agent_ip.
    -- To avoid a second SQL query when going to compat mode let's
    -- change the column name in our own local temp. db.
    IF EXISTS (SELECT column_name
               FROM information_schema.columns
               WHERE table_name='vds' and column_name='ip') THEN
        ALTER TABLE vds RENAME COLUMN ip TO agent_ip;
    END IF;

Comment 2 Yaniv Lavi 2018-01-15 08:41:16 UTC
Please make sure you don't break compatibility with 3.x which is the main use case of the analyzer right now.

Comment 3 David Necpal 2018-02-27 17:28:51 UTC
Verified on version ovirt-log-collector-analyzer-4.2.4-3.el7ev.noarch

Comment 4 Sandro Bonazzola 2018-03-29 11:12:30 UTC
This bugzilla is included in oVirt 4.2.2 release, published on March 28th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.2 release, it has been closed with a resolution of CURRENT RELEASE.

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