First, don't be scared off by 20 patches... They're not that difficult.
Second, don't be scared off by the all the various code touched.
Third, look at all the lines of code being removed! That's unlike
my normal patch series!
This is really the end game of what I started last year trying
to make object access code to be "more common". The last and worse
is/was the domain object code which really has a mish-mash of
usage models and is (to say the least) confusing depending on
the algorithm chosen (ByRef or not).
This series focuses on the various virDomainObjListFindBy* APIs
to do common things *and* allows the callers to use the common
virDomainObjEndAPI when done with the object rather than needing
to know whether they should virObjectUnlock and/or virObjectUnref.
There were one consumer (libxl) that leaked domain objs because
there was no Unref after a Ref on many API's. Additionally, there
was a possibility of a deadlock because of a missed Unlock.
This reduces a lot of code and reduces the number of virObjectUnlock
consumers.
Now *obviously* I don't have all these domain types available, but
since the goal was to remove the FindBy*Ref APIs, I had to touch
much more than I really want to. Of course only a couple are really
active anyway and I'm hoping they'll take a peek at their modules
(e.g. libxl, vz, and bhyve in particular).
Once/if this can get accomplished, fixing the Add and Remove API's
is the next task. Those are (to say the least) *really* confusing
because the caller should never have to call virObjectRef afterwards,
but some do because virDomainObjListAddLocked doesn't make enough
references on the obj (places the object in 2 lists, but only
accounts for 1). Lots of consumers that have to roll their own
"adjustments" because of that.
John Ferlan (20):
bhyve: Use virDomainObjListFindBy{UUID|ID}Ref
libxl: Fix possible deadlock in libxlDomainMigrateBegin3Params
libxl: Properly cleanup after libxlDomObjFromDomain
libxl: Use virDomainObjListFindBy{UUID|ID}Ref
openvz: Cleanup indention
openvz: Create accessors to virDomainObjListFindByUUID
openvz: Add more descriptive error message on Find failure
openvz: Use virDomainObjListFindBy{UUID|ID}Ref
uml: Create accessors to virDomainObjListFindByUUID
uml: Add more specific error message on failed FindBy call
uml: Use virDomainObjListFindBy{UUID|ID}Ref
vmware: Create accessors to virDomainObjListFindByUUID
vmware: Add more descriptive error message on Find failure
vmware: Properly clean up in vmwareDomainLookupByName
vmware: Use virDomainObjListFindBy{UUID|ID}Ref
vz: Unify vzDomObjFromDomain{Ref}
vz: Use virDomainObjListFindBy{UUID|ID}Ref
test: Use virDomainObjListFindByUUIDRef
conf: Rework/rename virDomainObjListFindByUUIDRef
conf: Rework/rename virDomainObjListFindByIDRef
src/bhyve/bhyve_driver.c | 52 ++----
src/conf/virdomainobjlist.c | 66 ++------
src/conf/virdomainobjlist.h | 4 -
src/libvirt_private.syms | 2 -
src/libxl/libxl_domain.c | 2 +-
src/libxl/libxl_driver.c | 99 ++++-------
src/libxl/libxl_migration.c | 3 +-
src/lxc/lxc_driver.c | 7 +-
src/openvz/openvz_driver.c | 392 ++++++++++++++-----------------------------
src/qemu/qemu_driver.c | 9 +-
src/test/test_driver.c | 8 +-
src/uml/uml_driver.c | 327 +++++++++++-------------------------
src/util/virclosecallbacks.c | 4 +-
src/vmware/vmware_driver.c | 234 +++++++++-----------------
src/vz/vz_driver.c | 117 +++++++------
src/vz/vz_sdk.c | 13 +-
src/vz/vz_utils.c | 34 +---
src/vz/vz_utils.h | 1 -
18 files changed, 458 insertions(+), 916 deletions(-)
--
2.13.6