Hi All!
I received a bug report about virtlockd emitting an error whenever libvirtd is
(re)started
May 25 15:44:31 virt81 virtlockd[7723]: Requested operation is not valid:
Lockspace for path /data/libvirtd/lockspace already exists
The problem is easily reproducible with git master by enabling lockd in
qemu.conf, setting file_lockspace_dir in qemu-lockd.conf, then restarting libvirtd.
If I understand the code correctly, when the qemu driver loads, it calls
virLockManagerPluginNew, which dlopens lockd.so and calls drvInit, aka
virLockManagerLockDaemonInit. Here the driver object is created, config loaded,
and virLockManagerLockDaemonSetupLockspace is called.
virLockManagerLockDaemonSetupLockspace sends
virLockSpaceProtocolCreateLockSpaceArgs rpc to virtlockd, where it is dispatched
to virLockSpaceProtocolDispatchCreateLockSpace. Alas we encounter the error when
virLockDaemonFindLockSpace finds the existing lockspace.
I'm not really sure how to go about fixing it and fishing for opinions.
virLockManagerLockDaemonSetupLockspace already has some code to handle the error
https://gitlab.com/libvirt/libvirt/-/blob/master/src/locking/lock_driver_lockd.c#L286
Since libvirtd ignores VIR_ERR_OPERATION_INVALID, should virtlockd be changed to
not return error in that case? It would be better if libvirtd knew it already
told virtlockd to configure the lockspace and avoid needlessly doing it again.
BTW, this cosmetic problem is exasperated by the default '--timeout 120' option
to libvirtd, since it results in more daemon restarts.
Thanks for any suggestions!
Jim