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

Bug 1813282

Summary: Race condition for listing node devices with socket activation of virnodedevd
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Daniel Berrangé <berrange>
Component: libvirtAssignee: Daniel Berrangé <berrange>
Status: CLOSED ERRATA QA Contact: yalzhang <yalzhang>
Severity: low Docs Contact:
Priority: medium    
Version: 8.2CC: jdenemar, jsuchane, lhuang, lmen, virt-maint, xuzhang, yafu
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-6.2.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-17 17:47:36 UTC Type: Enhancement
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Daniel Berrangé 2020-03-13 12:57:51 UTC
Description of problem:
Configure the host with the libvirt split modular daemons, instead of libvirtd

  https://libvirt.org/daemons.html#switching-to-modular-daemons

In this scenario no daemon is running initially. They are launched on-demand when a client connects to the socket.

The initialization of devices happens in the background though, so if an API call is made very quickly, many devices won't be known yet.

This can be seen by runing

$ virsh -c nodedev:///system nodedev-list
computer

It only shows one or two devices.

Wait 1 second and run it again, and you'll see all devices.

Version-Release number of selected component (if applicable):
libvirt-6.0.0-10.el8

How reproducible:
Semi-reliable

Steps to Reproduce:
1. Ensure  virtnodedevd.service is *NOT* currently active
2. Ensure virtnodedevd.socket IS currently active
3. Run virsh -c nodedev:///system nodedev-list

Actual results:
Only 1 or 2 devices are shown

Expected results:
All devices are shown.

Additional info:

Comment 1 Daniel Berrangé 2020-03-13 13:49:41 UTC
Fix posted at  https://www.redhat.com/archives/libvir-list/2020-March/msg00491.html

Comment 2 Daniel Berrangé 2020-04-03 10:51:35 UTC
Fixed in 6.2.0 with

commit 008abeb03c262149b756ad5a226ff6cbc5e37e2c
Author: Daniel P. Berrangé <berrange>
Date:   Fri Mar 13 11:53:25 2020 +0000

    nodedev: fix race in API usage vs initial device enumeration

Comment 6 yalzhang@redhat.com 2020-05-08 02:35:35 UTC
I can reproduce it with the steps in comment 0 with libvirt-6.0.0-18
And test on libvirt-libs-6.3.0-1.module+el8.3.0+6478+69f490bb.x86_64, no such issue. The bug is fixed.
# systemctl stop libvirtd
# systemctl start virtnodedevd.socket
# virsh -c nodedev:///system nodedev-list 
block_sda_36d09466077a944002306f0d40902561f
computer
drm_card0
net_eno1_20_04_0f_ea_f1_7c
net_eno2_20_04_0f_ea_f1_7d
net_eno3_20_04_0f_ea_f1_7e
net_eno4_20_04_0f_ea_f1_7f
net_enp6s0f0_f8_f2_1e_30_df_50
....

Comment 9 errata-xmlrpc 2020-11-17 17:47:36 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 (virt:8.3 bug fix and enhancement 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/RHBA-2020:5137