mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-25 22:15:20 +00:00
008abeb03c
During startup the udev node device driver impl uses a background thread to populate the list of devices to avoid blocking the daemon startup entirely. There is no synchronization to the public APIs, so it is possible for an application to start calling APIs before the device initialization is complete. This was not a problem in the old approach where libvirtd was started on boot, as initialization would easily complete before any APIs were called. With the use of socket activation, however, APIs are invoked from the very moment the daemon starts. This is easily seen by doing a 'virsh -c nodedev:///system list' the first time it runs it will only show one or two devices. The second time it runs it will show all devices. The solution is to introduce a flag and condition variable for APIs to synchronize against before returning any data. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>