Bug 2058925

Summary: Must-gather: for vms with longer name, gather_vms_details fails to collect qemu, dump xml logs
Product: Container Native Virtualization (CNV) Reporter: Debarati Basu-Nag <dbasunag>
Component: LoggingAssignee: Nahshon Unna-Tsameret <nunnatsa>
Status: CLOSED ERRATA QA Contact: Ohad <orevah>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.10.0CC: cnv-qe-bugs, stirabos
Target Milestone: ---   
Target Release: 4.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: v4.10.1-57 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2059613 (view as bug list) Environment:
Last Closed: 2022-09-14 19:28:43 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:    
Bug Blocks: 2059613    

Comment 2 Nahshon Unna-Tsameret 2022-03-02 08:39:29 UTC
The bug is where the script is trying to get the vm name from the virt-launcher pod name. The script assumes that the pod name is the vm name with a random addition, separated by a dash. But that is not true for VMs with to long name, and in this case the pod name is not exactly that; e.g. it lack the dash, and the last few characters.

PR https://github.com/kubevirt/must-gather/pull/127 fixes the bug by using different approach to get the VM name from the virt-launcher pod: it reads the "kubevirt.io/domain" annotation in the pod, assuming this is the VM name.

Comment 3 Nahshon Unna-Tsameret 2022-03-03 10:09:05 UTC
4.10 PR: https://github.com/kubevirt/must-gather/pull/129

Comment 4 Debarati Basu-Nag 2022-04-06 00:40:19 UTC
Verified against CNV-v4.11.0-192,

I still don't see vm files getting collected.
Below errors are snippets collected from the output:
========================
[must-gather-rsfnn] POD 2022-04-06T00:23:08.296710247Z + vm_collection_path=/must-gather/namespaces/must-gather-alternate/vms/must-gather-alternate-namespace-vm-2-1649204386-1836267
[must-gather-rsfnn] POD 2022-04-06T00:23:08.296710247Z + mkdir -p /must-gather/namespaces/must-gather-alternate/vms/must-gather-alternate-namespace-vm-2-1649204386-1836267
[must-gather-rsfnn] POD 2022-04-06T00:23:08.298974321Z + /usr/bin/oc adm inspect --dest-dir /must-gather -n must-gather-alternate pod ''
[must-gather-rsfnn] POD 2022-04-06T00:23:08.386632319Z error: resource name may not be empty
[must-gather-rsfnn] POD 2022-04-06T00:23:08.389719986Z + /usr/bin/oc adm inspect --dest-dir /must-gather -n must-gather-alternate virtualmachineinstances must-gather-alternate-namespace-vm-2-1649204386-1836267
[must-gather-rsfnn] POD 2022-04-06T00:23:09.407387586Z Wrote inspect data to /must-gather.
[must-gather-rsfnn] POD 2022-04-06T00:23:09.412875614Z + /usr/bin/oc exec '' -n must-gather-alternate -c compute -- virsh dumpxml must-gather-alternate_must-gather-alternate-namespace-vm-2-1649204386-1836267
[must-gather-rsfnn] POD 2022-04-06T00:23:09.489114578Z error: pod, type/name or --filename must be specified
[must-gather-rsfnn] POD 2022-04-06T00:23:09.493192622Z + /usr/bin/oc exec '' -n must-gather-alternate -c compute -- cat /var/log/libvirt/qemu/must-gather-alternate_must-gather-alternate-namespace-vm-2-1649204386-1836267.log
[must-gather-rsfnn] POD 2022-04-06T00:23:09.551922386Z error: pod, type/name or --filename must be specified
[must-gather-rsfnn] POD 2022-04-06T00:23:09.556664926Z + /usr/bin/oc exec '' -n must-gather-alternate -c compute -- ip a
========================
Will attach the full output and folder structure.

Comment 7 Debarati Basu-Nag 2022-07-25 21:17:12 UTC
Validated against 4.11 -577:
=========
[cnv-qe-jenkins@c01-db-411-8xdfz-executor ~]$ ls -ltR /tmp/pytest-MpsHiFh45QCm4zr3JcWipH/must_gather_scope_module0/registry-redhat-io-container-native-virtualization-cnv-must-gather-rhel8-sha256-17db4aff6e9eecd84f3afa845cdb64fd759f8ee12d69eea544b31ecf5b33360e/namespaces/node-gather-unprivileged/vms/must-gather-vm-this-is-supposed-to-be-long-2-1658783035-8249176/
/tmp/pytest-MpsHiFh45QCm4zr3JcWipH/must_gather_scope_module0/registry-redhat-io-container-native-virtualization-cnv-must-gather-rhel8-sha256-17db4aff6e9eecd84f3afa845cdb64fd759f8ee12d69eea544b31ecf5b33360e/namespaces/node-gather-unprivileged/vms/must-gather-vm-this-is-supposed-to-be-long-2-1658783035-8249176/:
total 32
drwxr-xr-x. 2 cnv-qe-jenkins cnv-qe-jenkins    6 Jul 25 21:06 log
-rw-r--r--. 1 cnv-qe-jenkins cnv-qe-jenkins 1496 Jul 25 21:06 virt-launcher-must-gather-vm-this-is-supposed-to-be-long-28zsz6.ruletables.txt
-rw-r--r--. 1 cnv-qe-jenkins cnv-qe-jenkins 2008 Jul 25 21:06 virt-launcher-must-gather-vm-this-is-supposed-to-be-long-28zsz6.bridge.txt
-rw-r--r--. 1 cnv-qe-jenkins cnv-qe-jenkins 2182 Jul 25 21:06 virt-launcher-must-gather-vm-this-is-supposed-to-be-long-28zsz6.ip.txt
-rw-r--r--. 1 cnv-qe-jenkins cnv-qe-jenkins 9505 Jul 25 21:06 virt-launcher-must-gather-vm-this-is-supposed-to-be-long-28zsz6.dumpxml.xml
-rw-------. 1 cnv-qe-jenkins cnv-qe-jenkins 8132 Jul 25 21:05 node-gather-unprivileged_must-gather-vm-this-is-supposed-to-be-long-2-1658783035-8249176.log

/tmp/pytest-MpsHiFh45QCm4zr3JcWipH/must_gather_scope_module0/registry-redhat-io-container-native-virtualization-cnv-must-gather-rhel8-sha256-17db4aff6e9eecd84f3afa845cdb64fd759f8ee12d69eea544b31ecf5b33360e/namespaces/node-gather-unprivileged/vms/must-gather-vm-this-is-supposed-to-be-long-2-1658783035-8249176/log:
total 0
[cnv-qe-jenkins@c01-db-411-8xdfz-executor ~]$

Comment 10 errata-xmlrpc 2022-09-14 19:28:43 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 (Important: OpenShift Virtualization 4.11.0 Images security and bug fix update), 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/RHSA-2022:6526