Bug 1583927

Summary: "Unexpected hostdev type while encoding audit message: 4" when attach a mdev device.
Product: Red Hat Enterprise Linux 7 Reporter: Fangge Jin <fjin>
Component: libvirtAssignee: Erik Skultety <eskultet>
Status: CLOSED ERRATA QA Contact: yafu <yafu>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.6CC: dyuan, lmen, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-4.4.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 09:55:31 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:

Description Fangge Jin 2018-05-30 03:26:24 UTC
Description of problem:
"Unexpected hostdev type while encoding audit message: 4" when attach a mdev hostdev.

Version-Release number of selected component (if applicable):
libvirt-4.3.0-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
0.Prepare mdev device

1.Start a guest 

2.Attach mdev device to guest:
# cat /tmp/mdev.xml
<hostdev mode='subsystem' type='mdev' model='vfio-pci'> 
   <source> 
      <address uuid='7bb8579b-55ca-4f4d-b70f-498a583c1e6e'/> 
   </source> 
   <alias name='ua-0febf033-9953-40e1-b803-2df42b0bac4e'/>
</hostdev>

# virsh attach-device 1 /tmp/mdev.xml 
Device attached successfully

3.Check libvirtd log:
2018-05-30 03:20:57.241+0000: 19704: warning : virDomainAuditHostdev:424 : Unexpected hostdev type while encoding audit message: 4


Actual results:
Warning when log audit message for mdev device.

Expected results:
Audit log is recorded successfully

Additional info:

Comment 2 Erik Skultety 2018-05-31 10:16:19 UTC
Fixed upstream by:
Refs: v4.4.0-rc1-7-ge0fae78ad5
Author:     Erik Skultety <eskultet>
AuthorDate: Thu May 31 09:42:58 2018 +0200
Commit:     Erik Skultety <eskultet>
CommitDate: Thu May 31 12:09:50 2018 +0200

    audit: Enforce enum switch type cast in virDomainAuditHostdev

    There was a missing enum for mdev causing a strange 'unknown device type'
    warning when hot-plugging mdev.

    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1583927

    Signed-off-by: Erik Skultety <eskultet>

Comment 4 yafu 2018-08-31 03:09:35 UTC
Reproduced with libvirt-4.3.0-1.el7.x86_64.

Verified with libvirt-4.5.0-7.el7.x86_64.
Test steps are the same as comment 0. And no warning "Unexpected hostdev type while encoding audit message" in libvirtd.log when attaching a mdev device.

Comment 6 errata-xmlrpc 2018-10-30 09:55:31 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://access.redhat.com/errata/RHSA-2018:3113