As evidenced by various code comments, the process of adding and
removing objects to/from the domain object list is problematic.
Long story short is that the Add logic doesn't generate enough
object references and the Remove logic removes one extra than
was added during Add and leaves the object unlocked upon return
(as well as doing a small fire dance to ensure proper lock
ordering). Some drivers (libxl, lxc, qemu, and vz) handle the
not enough references by adding an virObjectRef to the object
returned from the Add code, while others (bhyve, openvz, test,
uml, and vmware) live rather vicariously and carefully, but at
least don't reference the object after calling Remove.
Fixing all this will take a few patch streams across a few
mostly dormant driver modules and some coordination with the
vir*FindBy{UUID|ID|Name} logic. Some of that was already posted
previously, but only received minimal notice:
https://www.redhat.com/archives/libvir-list/2018-March/msg00489.html
So rather than (re)posting a 20-30 patch series on list which
probably won't get reviewed, I'll take things in smaller batches
of patches in the hopes that all this can be worked through so
that the end result is "cleaner" (and agreed upon).
John Ferlan (4):
conf: Fix error path logic in virDomainObjListAddLocked
conf: Fix error path logic in virDomainObjListLoadStatus
conf: Introduce virDomainObjListAddObjLocked
conf: Fix virDomainObjParseFile object handling
src/conf/virdomainobjlist.c | 63 ++++++++++++++++++++++++++++-----------------
src/lxc/lxc_controller.c | 2 +-
tests/qemuxml2xmltest.c | 2 +-
3 files changed, 42 insertions(+), 25 deletions(-)