Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2069619

Summary: [16.2] [Regression] Nova instance QEMU logs are not created under /var/log/libvirt/qemu/
Product: Red Hat OpenStack Reporter: Kashyap Chamarthy <kchamart>
Component: openstack-tripleo-heat-templatesAssignee: Bogdan Dobrelya <bdobreli>
Status: CLOSED ERRATA QA Contact: James Parker <jparker>
Severity: high Docs Contact:
Priority: high    
Version: 16.2 (Train)CC: alifshit, bdobreli, dasmith, eglynn, jhakimra, jparker, kchamart, marjones, mburns, mschuppe, pgrist, sbauza, sgordon, vromanso
Target Milestone: z3Keywords: Regression, Triaged
Target Release: 16.2 (Train on RHEL 8.4)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-tripleo-heat-templates-11.6.1-2.20220409004848.7c89b16.el8osttrunk Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2069755 (view as bug list) Environment:
Last Closed: 2022-06-22 16:06:16 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: 2069755    

Description Kashyap Chamarthy 2022-03-29 09:21:23 UTC
Description of problem
----------------------

Instance-specific QEMU logs are normally created by default under  /var/log/libvirt/qemu/ in "nova_libvirt" container.  Right now, the instance-specific QEMU logs are not created at all.  We lose valuable logging information and potentially important error messages

This is a regression.

Versions
--------

- openstack-selinux-0.8.29-2.20211108135018.7211283.el8ost.noarch
- libvirt-daemon-kvm-7.0.0-14.6.module+el8.4.0+13801+378af433.x86_64
- containers-common-1.2.2-8.module+el8.4.0+11818+341460ad.x86_64
- openstack-tripleo-common-container-base-11.7.1-2.20211218004850.173edba.el8ost.noarch
- container-selinux-2.167.0-1.module+el8.4.0+12448+09f02219.noarch


How reproducible: 100%


Steps to Reproduce
------------------

1. On an OSP 16.2 running  RHEL 8.4, launch an instance, make sure it is active.

2. `exec` into the "nova_libvirt" container: podman exec -it nova_libvirt /bin/bash

3. Check /var/log/libvirt/qemu/ for the instance log, of the form instance-yyyyyyy.log.  Also check the location on the container host: /var/log/containers/libvirt/qemu/



Actual results
--------------

Nova (QEMU) instance log of the form instance-yyyyyy.log are not created at all.  Both the locations, /var/log/libvirt/qemu/ in the container and /var/log/containers/libvirt/qemu/ on the container host are empty.


Expected results
----------------

Nova (QEMU) instance log of the form instance-yyyyyy.log must be created under /var/log/libvirt/qemu/.

Comment 3 Lon Hohberger 2022-03-29 14:16:00 UTC
I checked 16.2.2 vs 16.2.1 - no changes in libvirt or qemu-kvm are relevant.  (I realized later this was a change in behavior since 16.1, which is substantially different from 16.2; it would take some time to isolate those changes)

Comment 4 Kashyap Chamarthy 2022-03-29 14:23:02 UTC
Okay, I'm running out of ideas here.  What have we ruled out so far:

(1) It's not a QEMU issue

(2) It is also not a libvirt issue

(3) it's not SELinux -- the machine is already running in "permissive" mode

(4) I have also tried changing the SELinux "type" from 'container_ro_file_t' to 'virt_log_t' on /var/log/libvirt/qemu/ directory: 

    # Inside 'nova_libvirt' container, as "root"
    $> cd /var/log/libvirt/
    $> chcon -R -t virt_log_t qemu/
    $> ls -lsrtZ /var/log/libvirt/  | grep qemu
    0 drwxr-xr-x. 2 root root system_u:object_r:virt_log_t:s0                 6 Mar 21 15:26 qemu  

But that doesn't help either, as we're already running in permissive.  So I changed it back to "container_ro_file_t":

    $> chcon -R -t container_ro_file_t qemu/                                                                                                                        

(5) The _file_ permissions on /var/log/libvirt/qemu itself look fine, with "root:" and 755.  (Although on my F35 box, qemu/ directory has 700 permissions)


So, overall the issue is "somewhere" in the way we're launching the 'nova_libvirt' container.

Let's check with Martin Schuppert for some more input here.

Comment 5 Martin Schuppert 2022-03-29 14:31:52 UTC
The logs are in virtlogd container and this container miss the host volume mount:
[root@computeamdsev-1 ~]# podman exec -it nova_virtlogd /bin/bash
[root@computeamdsev-1 /]# ls -la /var/log/libvirt/qemu/ | head -n 10
total 1484
drwx------. 1 root root  8192 Mar 28 18:03 .
drwx------. 1 root root    18 Mar 10 23:47 ..
-rw-------. 1 root root  8592 Mar 29 13:56 el9vm1.log
-rw-------. 1 root root  6135 Mar 25 12:43 instance-0000007c.log
-rw-------. 1 root root  6135 Mar 25 12:43 instance-0000007d.log
-rw-------. 1 root root  6134 Mar 25 12:44 instance-00000080.log
-rw-------. 1 root root  6135 Mar 25 12:43 instance-00000082.log
-rw-------. 1 root root  6135 Mar 25 12:43 instance-00000083.log
-rw-------. 1 root root  7206 Mar 25 12:44 instance-00000085.log

libvirt container:
            {
                "Type": "bind",
                "Source": "/var/log/containers/libvirt",
                "Destination": "/var/log/libvirt",
                "Driver": "",
                "Mode": "",
                "Options": [
                    "rbind"
                ],
                "RW": true,
                "Propagation": "shared"
            },

the virtlogd container is missing this.

Comment 7 Kashyap Chamarthy 2022-03-29 15:03:40 UTC
(In reply to Martin Schuppert from comment #6)
> probably related to
> https://github.com/openstack/tripleo-heat-templates/commit/
> 41eca11495a94cbcab876e323761e6d947ae0bf2

It looks like the bind-mount was accidentally in this patch[1].  See the line that was removed in nova-libvirt-container-puppet.yaml file[2]:

    - /var/log/libvirt/qemu:/var/log/libvirt/qemu:ro

We need to add this back.

And ship a fix as quickly as possible.  Because even though the logs are in "nova_virtlogd" container, you will lose the logs
once you restart the container -- which is terrible from a debugging point of view, as we lose valuable logs.

[1] https://review.opendev.org/c/openstack/tripleo-heat-templates/+/817733/
    Fix libvirt/qemu logs location

[2] https://review.opendev.org/c/openstack/tripleo-heat-templates/+/817733/1/deployment/nova/nova-libvirt-container-puppet.yaml

Comment 21 errata-xmlrpc 2022-06-22 16:06:16 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 (Release of components for Red Hat OpenStack Platform 16.2.3 (Train)), 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:4793