Bug 1934063 - Service for kvm_stat logging not available
Summary: Service for kvm_stat logging not available
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: rawhide
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1919930 1934042
Blocks: ZedoraTracker PPCTracker
TreeView+ depends on / blocked
 
Reported: 2021-03-02 12:25 UTC by Thomas Huth
Modified: 2021-07-01 07:47 UTC (History)
34 users (show)

Fixed In Version:
Clone Of: 1934042
Environment:
Last Closed: 2021-07-01 07:47:21 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
IBM Linux Technology Center 191749 0 None None None 2021-03-02 16:51:18 UTC
Red Hat Bugzilla 1919930 1 None None None 2023-06-27 10:47:35 UTC

Internal Links: 1934042

Description Thomas Huth 2021-03-02 12:25:20 UTC
+++ This bug was initially created as a clone of Bug #1934042 +++

Description of problem:
/usr/lib/systemd/system/kvm_stat.service could not added with kernel-tools, need to add manually, 

Version-Release number of selected component (if applicable):
host kernel:5.11.0-0.rc7.151.el9.s390x
qemu:qemu-kvm-5.2.0-7.el9.s390x
guest kernel:5.11.0-0.rc7.151.el9.s390x

How reproducible:
100%

Steps to Reproduce:
1.Install kernel-tools package
2.Try to start kvm_stat logging via 'systemctl start kvm_stat.service

Actual results:
[root@l42 ~]# systemctl start kvm_stat
Failed to start kvm_stat.service: Unit kvm_stat.service not found.

Expected results:
[root@l42 bfu]# systemctl status kvm_stat
● kvm_stat.service - Service that logs KVM kernel module trace events
     Loaded: loaded (/usr/lib/systemd/system/kvm_stat.service; disabled; vendor preset: disabled)
     Active: active (running) since Tue 2021-03-02 04:19:38 EST; 2s ago
   Main PID: 647939 (kvm_stat)
      Tasks: 1 (limit: 28846)
     Memory: 10.7M
        CPU: 110ms
     CGroup: /system.slice/kvm_stat.service
             └─647939 /usr/bin/python3 -s /usr/bin/kvm_stat -dtcz -s 0.1 -L /var/log/kvm_stat.csv

Comment 1 Thomas Huth 2021-03-02 12:32:50 UTC
Beside the missing kvm_stat.service file (which can be found in the tools/kvm/kvm_stat/ folder of the kernel sources), we'd also need a matching logrotate config file like this:

/var/log/kvm_stat.csv {
        size 10M
        missingok
        compress
        maxage 30
        rotate 5
        nodateext
        postrotate
                /usr/bin/systemctl try-restart kvm_stat.service
        endscript
}

Comment 2 Thomas Huth 2021-03-02 15:23:06 UTC
FWIW, this were the changes that I did for the RHEL8 kernel spec file (for BZ 1919930):

diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index 32dac629b11c..78922902c1f3 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -540,6 +540,7 @@ Source400: mod-kvm.list
 # Sources for kernel-tools
 Source2000: cpupower.service
 Source2001: cpupower.config
+Source2002: kvm_stat.logrotate
 
 ## Patches needed for building this package
 
@@ -2086,9 +2087,11 @@ popd
 pushd tools/gpio
 %{tools_make} DESTDIR=%{buildroot} install
 popd
+install -m644 -D %{SOURCE2002} %{buildroot}%{_sysconfdir}/logrotate.d/kvm_stat
 pushd tools/kvm/kvm_stat
 make INSTALL_ROOT=%{buildroot} install-tools
 make INSTALL_ROOT=%{buildroot} install-man
+install -m644 -D kvm_stat.service %{buildroot}%{_unitdir}/kvm_stat.service
 popd
 # install VM tools
 pushd tools/vm/
@@ -2448,6 +2451,8 @@ fi
 %{_bindir}/gpio-event-mon
 %{_mandir}/man1/kvm_stat*
 %{_bindir}/kvm_stat
+%{_unitdir}/kvm_stat.service
+%config(noreplace) %{_sysconfdir}/logrotate.d/kvm_stat
 %{_bindir}/page_owner_sort
 %{_bindir}/slabinfo
 
diff --git a/redhat/kvm_stat.logrotate b/redhat/kvm_stat.logrotate
new file mode 100644
index 000000000000..105e15e651f0
--- /dev/null
+++ b/redhat/kvm_stat.logrotate
@@ -0,0 +1,11 @@
+/var/log/kvm_stat.csv {
+       size 10M
+       missingok
+       compress
+       maxage 30
+       rotate 5
+       nodateext
+       postrotate
+               /usr/bin/systemctl try-restart kvm_stat.service
+       endscript
+}

... I assume the spec file for the Fedora kernel could be adjusted in a similar way?

Comment 3 Thomas Huth 2021-07-01 07:47:21 UTC
Seems like this has been fixed in commit 4f81869d2aa7 by Jiri Benc - Thank you very much, Jiri!


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