Bug 1966137

Summary: Custom VMs are not highlighted in must-gather
Product: Container Native Virtualization (CNV) Reporter: Fabian Deutsch <fdeutsch>
Component: LoggingAssignee: Nahshon Unna-Tsameret <nunnatsa>
Status: CLOSED ERRATA QA Contact: Satyajit Bulage <sbulage>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.6.0CC: cnv-qe-bugs, ipinto, kmajcher, nunnatsa, ocohen, oramraz, rkishner, rnetser, sbulage, stirabos
Target Milestone: ---   
Target Release: 4.9.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: hco-bundle-registry-container-v4.9.3-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-02-22 21:54:59 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:
Bug Depends On: 2042856, 2042880, 2045143, 2045156    
Bug Blocks:    

Description Fabian Deutsch 2021-05-31 13:25:30 UTC
Description of problem:
Custoemrs can create VMs from temapltes or write them from scartch (as an extreme) - or anything in between.

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

How reproducible:
Always

Steps to Reproduce:
1. Write a custom VM
2. Create VM in CNV
3. RUn must-gather

Actual results:
All VMs look the same in must gather

Expected results:
Template based VMs are displayed
Custom VMs (not created from templates/withput a template reference) should be marked as custom or tainted

Additional info:

Comment 1 Ruth Netser 2021-06-02 11:59:36 UTC
@fdeutsch can you please explain what "marked" means? 
Does it mean adding a label/annotation? if so, for VMs from templates we have labels that can distinguish them.

Comment 2 Fabian Deutsch 2021-06-02 12:10:49 UTC
For now I'd only expect in the must gatehr colelctions to separate between VMs created from templates, and others created from scratch - or at least without a template.

It would be as simple as putting them in a different section, i.e.

"""
Template based VMs:
rhel8-bar
…

CUSTOM VMs:
my-vm02
…
"""

Comment 3 Ruth Netser 2021-06-09 11:14:15 UTC
As discussed, custom VMs and VMs from templates should reside under 2 separate directories under the relevant ns.

Comment 4 Roni Kishner 2021-11-11 15:18:29 UTC
The fix include only VM's, no VMI's or any other resource type.

Comment 5 Roni Kishner 2021-11-15 10:25:13 UTC
1. Created a custom-vm, and a template-based-vm
2. run: oc adm must-gather --image=quay.io/kubevirt/must-gather -- /usr/bin/gather_virtualmachines
3. verified the VM.yaml files are in 2 separate folders: template-based, custom

* For the current time the must-gather command have different code changes depending on the image name effecting some of the folders names. running this command while using other images will bring different results for example:
--image=registry-proxy.engineering.redhat.com/rh-osbs/container-native-virtualization-cnv-must-gather-rhel8:v4.9.1

Comment 6 Roni Kishner 2021-11-15 11:48:10 UTC
Waiting for confirmation if the function should only return VMs without VMI/virt-launcher.

Comment 7 Satyajit Bulage 2022-01-05 13:55:44 UTC
Hello Roni,

Can you please tell me more about comment 5, what is missing?

I did follow same steps mentioned in the BZ description and able to see the virtual machines in the separate folder,
as custom and template-based.

Thanks,
Satyajit.

Comment 8 Roni Kishner 2022-01-05 14:34:46 UTC
Nothing is missing, this bug is verified for separating the vms to 2 folders, the reason this was not moved to verified, 
is because a discussion was needed about why we only gather the VM info without the VMI info.

Looking at the must-gather repository now i can see a PR was made and merged after the discussion, moving to verify now, thank you.

Comment 9 Nahshon Unna-Tsameret 2022-01-09 12:36:29 UTC
Reopen the bug. The new script is looking for the `vm.kubevirt.io/template` key in annotation instead of under labels, and so all the VMs goes to the custom directory.

Comment 10 Oded Ramraz 2022-01-10 16:53:37 UTC
@n(In reply to Nahshon Unna-Tsameret from comment #9)
> Reopen the bug. The new script is looking for the `vm.kubevirt.io/template`
> key in annotation instead of under labels, and so all the VMs goes to the
> custom directory.

Hi Nahshon, how urgent is it can we update the target version for this bug to 4.9.3?

Comment 11 Nahshon Unna-Tsameret 2022-01-12 14:12:49 UTC
@oramraz - I don't really know. I don't understand this separation (custom / template_based). But the current version failed to do that.

Comment 12 Krzysztof Majcher 2022-01-12 14:26:53 UTC
Moving this for 4.9.3.
I believe we can use 4.10 version (that is fixed) must gather on 4.9.x line if needed.

Comment 13 Roni Kishner 2022-01-17 13:45:21 UTC
When running 4.9.3 version all the VMs are on custom directory.
When running 4.10 version all the VMs are on template-based directory.

I don't think 4.10 is fixed, I created several VMs in different ways and all of them are in template-based.

Comment 14 Nahshon Unna-Tsameret 2022-01-26 07:00:53 UTC
New fix merged in upstream for 4.10: https://github.com/kubevirt/must-gather/pull/117. Now working on downstream adoption.
New cherry-pick for 4.9 is in https://github.com/kubevirt/must-gather/pull/121

Comment 15 Roni Kishner 2022-01-27 09:36:32 UTC
Verified 2 folders are being created and VMs are being collected.

Was it decided that only VMs should be collected and no VMIs?

Comment 16 Nahshon Unna-Tsameret 2022-01-27 19:49:15 UTC
VMIs are collected as well, but they are not split to custom/VMs.

Comment 17 Satyajit Bulage 2022-02-09 10:45:52 UTC
I am able to see the segregation of VM's as follows:

==============
For CNV 4.9.3:
==============
---------------------------------------------------------------------------------------------------------------------------------------------------------------+
$ ls default/kubevirt.io/virtualmachines/custom/ default/kubevirt.io/virtualmachines/template-based/ openshift-cnv/kubevirt.io/virtualmachines/template-based/ |
---------------------------------------------------------------------------------------------------------------------------------------------------------------+
Output:
------------------------------------------------------------+
default/kubevirt.io/virtualmachines/custom/:                |
custom-vm.yaml                                              |
                                                            |
default/kubevirt.io/virtualmachines/template-based/:        |
vm-example.yaml                                             |
                                                            |
openshift-cnv/kubevirt.io/virtualmachines/template-based/:  |
vm-template-example-semantic-sparrow.yaml                   |  
------------------------------------------------------------+
=============
For CNV 4.10:
=============
-----------------------------------------------------------------------------------------------------+
$ ls default/kubevirt.io/virtualmachines/custom/ default/kubevirt.io/virtualmachines/template-based/ |
-----------------------------------------------------------------------------------------------------+
Output:
-----------------------------------------------------+
default/kubevirt.io/virtualmachines/custom/:         |
vm-example-default-ns.yaml  vm-example.yaml          |
                                                     |
default/kubevirt.io/virtualmachines/template-based/: |
vm-template-example-institutional-platypus.yaml      |
-----------------------------------------------------+

Comment 18 Satyajit Bulage 2022-02-09 10:46:22 UTC
Verifying BZ.

Comment 25 errata-xmlrpc 2022-02-22 21:54:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Virtualization 4.9.3 Images), and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHBA-2022:0641