Bug 1333159

Summary: qemu-kvm doesn't reload udev rules before triggering for kvm device
Product: Red Hat Enterprise Linux 7 Reporter: Olimp Bockowski <obockows>
Component: qemu-kvmAssignee: Miroslav Rezanina <mrezanin>
Status: CLOSED ERRATA QA Contact: FuXiangChun <xfu>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: areis, chayang, huding, jen, juzhang, knoel, mrezanin, obockows, ppostler, rbalakri, virt-maint, xfu, yfu
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-114.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1338755 (view as bug list) Environment:
Last Closed: 2016-11-03 20:13:06 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: 1338755    

Description Olimp Bockowski 2016-05-04 19:32:33 UTC
Description of problem:

qemu-kvm(-rhev) package does not call "udevadm control --reload-rules" before triggering for kvm device
a rule setting /dev/kvm ownership and permsions is missed while installing qemu-kvm-rhev package


Version-Release number of selected component (if applicable):
qemu-kvm 1.5.3
qemu-kvm-rhev 2.3.0

How reproducible:

every time

Steps to Reproduce:

yum remove qemu-kvm-rhev
rmmod kvm_intel kvm ixgbe ; modprobe kvm_intel ; modprobe ixgbe
ls -l /dev/kvm
  crw-------. 1 root root 10, 232 26.4. 13:10 /dev/kvm
./sriov.sh ; yum install -y qemu-kvm-rhev
  Creating maximum number of SR-IOV VF insterfaces for the PCI device 0000:87:00.1
  Creating maximum number of SR-IOV VF insterfaces for the PCI device 0000:87:00.0
ls -l /dev/kvm
  crw-------. 1 root root 10, 232 26.4. 13:11 /dev/kvm
yum remove qemu-kvm-rhev
yum install -y qemu-kvm-rhev
ls -l /dev/kvm
  crw-rw-rw-. 1 root kvm 10, 232 26.4. 13:12 /dev/kvm

Actual results:

before triggering for kvm device qemu-kvm(-rhev) doesn't call:
udevadm control --reload-rules


Expected results:

calls

Additional info:

More detailed tests, information in attached case

Comment 2 Olimp Bockowski 2016-05-05 07:16:55 UTC
Hello,

Simpler way to reproduce:

#prepare
rmmod kvm kvm_intel
yum remove  qemu-kvm
modprobe kvm_intel
# owner of /dev/kvm should be root. root
# Test
udevadm trigger 
yum install -y qemu-kvm
# notably install must complete with 3s from trigger fpr bug to occur
# check /dev/kvm owner it should be root.kvm if not you hit the bug

If trigger is omitted above the permissions will change as they should

olimpb

Comment 6 Miroslav Rezanina 2016-06-15 09:20:22 UTC
Fix included in qemu-kvm-1.5.3-114.el7

Comment 9 FuXiangChun 2016-09-05 07:46:05 UTC
I got the same result between fixed and unfixed qemu-kvm. so I am not sure if this bug is fixed.  Could you help me take a look at these steps?  If it is wrong. please correct it. 

steps:

1.#rmmod kvm kvm_intel

2.#rpm -e qemu-kvm-tools-1.5.3-105.el7.x86_64 qemu-kvm-common-1.5.3-105.el7.x86_64 qemu-kvm-debuginfo-1.5.3-105.el7.x86_64 qemu-img-1.5.3-105.el7.x86_64 qemu-kvm-1.5.3-105.el7.x86_64

3.# modprobe kvm_intel

4.# ll /dev/kvm
crw------- 1 root root 10, 232 Sep  5 15:20 /dev/kvm

5.#rpm -ivh qemu*(qemu-kvm-1.5.3-105......)

6.# ll /dev/kvm
crw-rw-rw- 1 root kvm 10, 232 Sep  5 15:20 /dev/kvm

The fixed version(qemu-kvm-1.5.3-121) and unfixed version(qemu-kvm-1.5.3-105.el7) got the same result as above.

Comment 10 Yanan Fu 2016-09-14 08:43:57 UTC
cancel the needinfo in comment 9 as can reproduce it now.

-------------------------reproduce---------------------
Test version:
qemu-kvm-1.5.3-113.el7.x86_64

Test steps:
1. unload kvm module, uninstall qemu-kvm
  # rmmod kvm-intel kvm
  # rpm -qa | grep qemu-kvm
    qemu-kvm-common-1.5.3-113.el7.x86_64
    qemu-kvm-1.5.3-113.el7.x86_64
  # yum remove -y qemu-kvm-common-1.5.3-113.el7.x86_64 qemu-kvm-1.5.3-113.el7.x86_64

2. load kvm module
  # modprobe kvm_intel
  # lsmod | grep kvm
   kvm_intel             170125  0 
   kvm                   543643  1 kvm_intel
   irqbypass              13503  2 kvm,vfio_pci

3. check owner of /dev/kvm, it is "root.root", right result.
  # ll /dev/kvm
    crw-------. 1 root root 10, 232 Sep 14 04:26 /dev/kvm

4. Install qemu-kvm while doing "udevadm trigger"
  # udevadm trigger; yum install -y ./qemu-*
  # rpm -qa | grep qemu-kvm
    qemu-kvm-common-1.5.3-113.el7.x86_64
    qemu-kvm-1.5.3-113.el7.x86_64

5. check owner of /dev/kvm, it is "root.root", so hit this issue.
  # ll /dev/kvm
   crw-------. 1 root root 10, 232 Sep 14 04:28 /dev/kvm

6. uninstall qemu-kvm, then install qemu-kvm without "udevadm trigger"
  # yum remove -y qemu-kvm-common-1.5.3-113.el7.x86_64 qemu-kvm-1.5.3-113.el7.x86_64
  # yum install -y ./qemu-*

7. check owner of /dev/kvm, it is "root.kvm"
  # ll /dev/kvm
crw-rw-rw-. 1 root kvm 10, 232 Sep 14 04:30 /dev/kvm

reproduce this bug successfully according the result of step 5.

-------------------------verification---------------------
Test version:
qemu-kvm-1.5.3-124.el7.x86_64

Test steps:
same steps with above.
1. unload kvm module, uninstall qemu-kvm
2. load kvm module
3. check owner of /dev/kvm, it is "root.root", right result.
4. install qemu-kvm while doing "udevadm trigger".
  # udevadm trigger; yum install -y ./* 
   (qemu-kvm-1.5.3-124.el7.x86_64)

5. check owner of /dev/kvm, it is "root.kvm".
  # ll /dev/kvm
   crw-rw-rw-. 1 root kvm 10, 232 Sep 14 04:32 /dev/kvm

Move to VERIFIED according to the test result above.

Comment 12 errata-xmlrpc 2016-11-03 20:13:06 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, 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://rhn.redhat.com/errata/RHSA-2016-2585.html