libvirt/src
Mark Asselstine 72d99b094b Avoid unnecessary error messages handling udev events
The udev monitor thread "udevEventHandleThread()" will lag the
actual/real view of devices in sysfs as it serially processes udev
monitor events. So for instance if you were to run the following cmd
to create a new veth pair and rename one of the veth endpoints

you might see the following monitor events and real world that looks like

                                     time
			              |    create v0 sysfs entry
wake udevEventHandleThread            |    create v1 sysfs entry
udev_monitor_receive_device(v1-add)   |    move v0 sysfs to v2
udevHandleOneDevice(v1)               |
udev_monitor_receive_device(v0-add)   |
udevHandleOneDevice(v0)               | <--- error msgs in virNetDevGetLinkInfo()
udev_monitor_receive_device(v2-move)  |      as v0 no longer exists
udevHandleOneDevice(v2)               |
                                     \/

As you can see the changes in sysfs can take place well before we get
to act on the events in the udevEventHandleThread(), so by the time we
get around to processing the v0 add event, the sysfs entry has been
moved to v2.

To work around this we check if the sysfs entry is valid before
attempting to read it and don't bother trying to read link info if
not. This is safe since we will never read sysfs entries earlier than
it existing, ie. if the entry is not there it has either been removed
in the time since we enumerated the device or something bigger is
busted, in either case, no sysfs entry, no link info. In the case
described above we will eventually get the link info as we work
through the queue of monitor events and get to the 'move' event.

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

Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-04-20 15:25:52 +02:00
..
access Remove virutil.h from all header files 2020-02-24 23:15:50 +01:00
admin admin: Introduce virAdmServerUpdateTlsFiles 2020-03-13 17:07:32 +00:00
bhyve bhyve: add missing param to virDomainPCIAddressBusSetModel 2020-04-16 15:49:28 +01:00
conf conf: Trivial comment fix 2020-04-16 16:38:07 +02:00
cpu cpu_x86: Add support for stepping part of CPU signature 2020-04-08 17:48:07 +02:00
cpu_map cpu_map: Distinguish Cascadelake-Server from Skylake-Server 2020-04-08 17:52:50 +02:00
esx virsh: include virutil.h where used 2020-02-24 23:15:50 +01:00
hyperv
hypervisor virDomainDriverGenerateMachineName: Factor out embed path hashing 2020-04-07 15:26:22 +02:00
interface systemd: Move timeout from service files to sysconf files 2020-04-03 11:50:50 +02:00
keycodemapdb@317d3eeb96
libxl xenconfig: Add support for max_event_channels 2020-04-09 15:45:05 -06:00
locking systemd: Tweak existing sysconf files 2020-04-03 11:50:35 +02:00
logging systemd: Tweak existing sysconf files 2020-04-03 11:50:35 +02:00
lxc conf: Move virDomainGenerateMachineName to hypervisor/ 2020-04-07 15:26:19 +02:00
network systemd: Move timeout from service files to sysconf files 2020-04-03 11:50:50 +02:00
node_device node_device_udev: handle move events 2020-04-20 15:25:52 +02:00
nwfilter systemd: Move timeout from service files to sysconf files 2020-04-03 11:50:50 +02:00
openvz vz: openvz: move video default logic to driver 2020-03-25 09:31:26 +01:00
qemu qemu: Label restore path outside of secdriver transactions 2020-04-17 16:24:30 +02:00
remote remote: Drop KRB5_KTNAME override 2020-04-03 11:51:00 +02:00
rpc rpc: avoid name lookup when dispatching node device APIs 2020-03-17 13:58:20 +00:00
secret systemd: Move timeout from service files to sysconf files 2020-04-03 11:50:50 +02:00
security qemu: Label restore path outside of secdriver transactions 2020-04-17 16:24:30 +02:00
storage systemd: Move timeout from service files to sysconf files 2020-04-03 11:50:50 +02:00
test test: move video default logic to driver 2020-03-25 09:31:30 +01:00
util Avoid unnecessary error messages handling udev events 2020-04-20 15:25:52 +02:00
vbox vbox: add support for version 6.1 SDK 2020-04-20 11:34:59 +01:00
vmware vmx: vmware: move video default logic to driver 2020-03-25 09:31:28 +01:00
vmx vmx: vmware: move video default logic to driver 2020-03-25 09:31:28 +01:00
vz systemd: Move timeout from service files to sysconf files 2020-04-03 11:50:50 +02:00
admin_protocol-structs admin: Introduce virAdmServerUpdateTlsFiles 2020-03-13 17:07:32 +00:00
datatypes.c
datatypes.h
driver-hypervisor.h
driver-interface.h
driver-network.h
driver-nodedev.h
driver-nwfilter.h
driver-secret.h
driver-state.h
driver-storage.h
driver-stream.h
driver.c driver: Yet 1 more g_autofree conversion change 2020-04-14 15:36:53 +02:00
driver.h
internal.h
libvirt_driver_modules.syms
libvirt_esx.syms
libvirt_internal.h
libvirt_libssh2.syms
libvirt_libssh.syms
libvirt_linux.syms
libvirt_lxc.syms
libvirt_openvz.syms
libvirt_private.syms security: Introduce virSecurityManagerDomainSetPathLabelRO 2020-04-17 16:24:30 +02:00
libvirt_probes.d
libvirt_public.syms
libvirt_qemu_probes.d
libvirt_qemu.syms
libvirt_remote.syms virnetserver: Introduce virNetServerUpdateTlsFiles 2020-03-13 17:07:32 +00:00
libvirt_sasl.syms
libvirt_vmware.syms
libvirt_vmx.syms
libvirt-domain-checkpoint.c
libvirt-domain-snapshot.c
libvirt-domain.c api: disallow virDomainAgentSetResponseTimeout() on read-only connections 2020-03-23 14:47:38 +01:00
libvirt-host.c
libvirt-interface.c
libvirt-lxc.c
libvirt-lxc.pc.in
libvirt-network.c
libvirt-nodedev.c
libvirt-nwfilter.c
libvirt-qemu.c
libvirt-qemu.pc.in
libvirt-secret.c
libvirt-storage.c
libvirt-stream.c libvirt-stream: Convert to the g_autofree usage 2020-04-14 15:37:01 +02:00
libvirt.c src: fix mixup of stack and heap allocated data in auth callback 2020-03-06 17:02:10 +00:00
libvirt.conf
libvirt.pc.in Fix src/ pkg-config API XML paths 2019-12-10 09:47:26 -05:00
lock_protocol-structs
lxc_monitor_protocol-structs
lxc_protocol-structs
Makefile.am src: introduce hypervisor/domain_cgroup.c 2020-02-23 14:02:23 +01:00
qemu_protocol-structs
README
remote_protocol-structs
virkeepaliveprotocol-structs
virnetprotocol-structs Introduce VIR_NET_STREAM_HOLE message type 2017-05-18 07:42:13 +02:00

       libvirt library code README
       ===========================

The directory provides the bulk of the libvirt codebase. Everything
except for the libvirtd daemon and client tools. The build uses a
large number of libtool convenience libraries - one for each child
directory, and then links them together for the final libvirt.so,
although some bits get linked directly to libvirtd daemon instead.

The files directly in this directory are supporting the public API
entry points & data structures.

There are two core shared modules to be aware of:

 * util/  - a collection of shared APIs that can be used by any
            code. This directory is always in the include path
            for all things built

 * conf/  - APIs for parsing / manipulating all the official XML
            files used by the public API. This directory is only
            in the include path for driver implementation modules

 * vmx/   - VMware VMX config handling (used by esx/ and vmware/)


Then there are the hypervisor implementations:

 * bhyve         - bhyve - The BSD Hypervisor
 * esx/          - VMware ESX and GSX support using vSphere API over SOAP
 * hyperv/       - Microsoft Hyper-V support using WinRM
 * lxc/          - Linux Native Containers
 * openvz/       - OpenVZ containers using cli tools
 * qemu/         - QEMU / KVM using qemu CLI/monitor
 * remote/       - Generic libvirt native RPC client
 * test/         - A "mock" driver for testing
 * vbox/         - Virtual Box using native API
 * vmware/       - VMware Workstation and Player using the vmrun tool
 * xen/          - Xen using hypercalls, XenD SEXPR & XenStore


Finally some secondary drivers that are shared for several HVs.
Currently these are used by LXC, OpenVZ, QEMU and Xen drivers.
The ESX, Hyper-V, Remote, Test & VirtualBox drivers all
implement the secondary drivers directly

 * cpu/          - CPU feature management
 * interface/    - Host network interface management
 * network/      - Virtual NAT networking
 * nwfilter/     - Network traffic filtering rules
 * node_device/  - Host device enumeration
 * secret/       - Secret management
 * security/     - Mandatory access control drivers
 * storage/      - Storage management drivers


Since both the hypervisor and secondary drivers can be built as
dlopen()able modules, it is *FORBIDDEN* to have build dependencies
between these directories. Drivers are only allowed to depend on
the public API, and the internal APIs in the util/ and conf/
directories