Bug 2006542 - rhv-image-discrepancies reports VM templates as LEAF in the DB.
Summary: rhv-image-discrepancies reports VM templates as LEAF in the DB.
Keywords:
Status: CLOSED DUPLICATE of bug 1955582
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: rhv-log-collector-analyzer
Version: 4.4.7
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ovirt-4.4.9
: ---
Assignee: Germano Veit Michel
QA Contact: meital avital
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-09-21 20:10 UTC by Bimal Chollera
Modified: 2021-09-22 21:13 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-09-22 21:13:06 UTC
oVirt Team: Integration
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHV-43689 0 None None None 2021-09-21 20:14:21 UTC

Description Bimal Chollera 2021-09-21 20:10:35 UTC
Description of problem:

rhv-image-discrepancies reports VM templates as LEAF in the DB.


From vm_images_view table:

~~~
-[ RECORD 1 ]----+-------------------------------------
vm_names         | aaa
image_guid       | 5af4f33d-4ff2-493e-9fec-514a1a00bbc4
entity_type      | TEMPLATE
disk_id          | 9a3c0ce1-7de5-43f1-98e0-d61a946cb01f
disk_alias       | aaa_Disk1
disk_description | 
vm_snapshot_id   | 69e7da13-8361-4987-843c-8d85019ed8b7
parentid         | 00000000-0000-0000-0000-000000000000
imagestatus      | 1
volume_type      | 2
volume_format    | 4
active           | t
size             | 1073741824
actual_size      | 200704
~~~

rhv-image-discrepancies:

~~~
	 Image 5af4f33d-4ff2-493e-9fec-514a1a00bbc4 has a different attribute voltype on storage(SHARED) and on DB(LEAF)
~~~


Version-Release number of selected component (if applicable):

4.4.7

How reproducible:

100%

Steps to Reproduce:
1.  Create a VM template.
2.  Run the rhv-image-discrepancies tool and the template image will be flagged.
3.

Actual results:

Expected results:


Additional info:

Comment 1 Germano Veit Michel 2021-09-21 22:59:37 UTC
This is not too different from the problem in BZ1873382, there is no direct equivalent in the DB so we need to make assumptions, I'll add some code to handle this case as well.

Comment 2 Germano Veit Michel 2021-09-22 05:04:47 UTC
Bimal, actually I think I've already fixed this one, what rhv-log-collector-analyzer version was this?

$ git show 7c6da6a2dd27a919fbe816d7fb1a06edcfe56249
commit 7c6da6a2dd27a919fbe816d7fb1a06edcfe56249
Author: Germano Veit Michel <germano@redhat.com>
Date:   Mon May 10 15:33:19 2021 +1000

    rhv-image-discrepancies: templates use shared type
    
    Images used by templates have LEAF type on the DB
    but SHARED on the storage. This changes the SQL on
    the DB side to produce a SHARED output if the LEAF
    image is part of a disk attached to a template.
    
    Bug-Url: https://bugzilla.redhat.com/1955582
    Signed-off-by: Germano Veit Michel <germano@redhat.com>
    Change-Id: Iad9555b4fbcd7f6f6c60ca48f9d04efeea1e113f

diff --git a/src/live/tools/rhv-image-discrepancies b/src/live/tools/rhv-image-discrepancies
index d588caa..b52c6da 100755
--- a/src/live/tools/rhv-image-discrepancies
+++ b/src/live/tools/rhv-image-discrepancies
@@ -47,11 +47,15 @@ DB_IMAGES = ("SELECT image_id, parentid, size, active, image_group_id, "
              "  WHEN '2' THEN 'SPARSE' "
              "END as volume_type, "
              "CASE "
-             "  WHEN i.active = 't' THEN 'LEAF' "
              "  WHEN i.parentid IN ("
              "    SELECT image_guid FROM snapshots s "
              "    INNER JOIN images i ON i.vm_snapshot_id = s.snapshot_id "
              "    WHERE s.status = 'IN_PREVIEW') THEN 'LEAF' "
+             "  WHEN i.image_guid IN ("
+             "    SELECT image_guid FROM images i "
+             "    JOIN vms_for_disk_view v ON i.image_group_id = v.device_id "
+             "    WHERE entity_type = 'TEMPLATE') THEN 'SHARED' "
+             "  WHEN i.active = 't' THEN 'LEAF' "
              "  ELSE 'INTERNAL' "
              "END AS active "
              "FROM images i "

Comment 3 Sandro Bonazzola 2021-09-22 06:53:34 UTC
$ git tag --contains 7c6da6a2dd27a919fbe816d7fb1a06edcfe56249
rhv-log-collector-analyzer-1.0.10
rhv-log-collector-analyzer-1.0.11
rhv-log-collector-analyzer-1.0.9


1.0.10 was shipped 2 months ago: https://access.redhat.com/errata/RHSA-2021:2865

Comment 4 Bimal Chollera 2021-09-22 16:24:39 UTC
Germano,

The version is rhv-log-collector-analyzer-1.0.8-1.el8ev.noarch.

You are correct, it is fixed in the rhv-log-collector-analyzer-1.0.10-1.el8ev.noarch.

Sorry for this and I guess we can close it out.

Thanks
Bimal.

Comment 5 Germano Veit Michel 2021-09-22 21:13:06 UTC
All good!

*** This bug has been marked as a duplicate of bug 1955582 ***


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