On Tue, Apr 13, 2021 at 05:33:49PM +0200, Michal Privoznik wrote:
On 4/13/21 4:58 PM, Erik Skultety wrote:
> On Tue, Apr 13, 2021 at 12:01:57PM +0200, Michal Privoznik wrote:
> > After all devices were enumerated, the enumeration thread call
> > nodeDeviceUpdateMediatedDevices() to refresh the state of
> > mediated devices. This means that 'mdevctl' will be executed. But
> > it may be missing on some systems (e.g. mine) in which case we
> > should just skip the update of mdevs instead of failing whole
> > device enumeration.
> >
> > Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
> > ---
...
> I'll give you an example where this can get annoying. I just
tested this on a
> machine where I had mdevctl installed previously, so I removed it, but I had
> some mdevs defined. Because mdevctl is now missing, udev reports some mdev
> devices, but that's it. After I re-installed mdevctl back I expected libvirtd
> to at least be able to define a device, but I got an error from mdevctl that
> that device already is defined, but libvirtd doesn't know it's persistent
> because /etc/mdevctl.d was never scanned, so I suddenly see devices as
> transient and have to manually remove the mdevctl definitions.
Fair enough, but is this even supposed to work? I mean, if you
install/uninstall a tool without libvirtd restart then you shouldn't expect
things to work. We use binaries, because some tools don't provide libraries.
If mdevctl was a library then no such thing as install/uninstall without
libvirtd would be possible. Either it would be still mapped into libvirtd
(even after you've removed it from disk), or it won't be loaded after you've
installed it.
Well, I guess that I disagree with one particular part of your answer -
"if you install/uninstall a tool without libvirtd restart then you shouldn't
expect things to work."
Actually, when we declare some tools as runtime dependencies, then yes, I'd
actually expect libvirt to have checks in place for the respective binaries and
stop erroring out when it manages to find those after having it installed or
conversely start erroring out when the tool disappears.
And for the record, ^this case was broken even after libvirtd restart.
I'll switch over to virFindFileInPath(), though.
Thanks.
Erik