1ea77165a0
- libxl: don't hardcode scheduler weight 83edaf44-libxl-dont-hardcode-sched-weight.patch bsc#1086377 - libxl: fixes and improvements in migration APIs 64370c4b-libxl-MigrateBegin.patch, 99486799-libxl-MigrateConfirm.patch, f5eacf2a-libxl-MigratePerform.patch, 4e6fcdb6-libxl-libxlDomObjFromDomain-cleanup.patch, fe51dbda-libxl-use-FindByRef.patch, 60b3fcd9-libxl-MigratePrepare.patch, 3c89868c-libxl-lock-after-ListRemove.patch, 13e81fc6-libxl-EndJob-on-error.patch, 594b8b99-libxl-DefineXMLFlags-API-pattern.patch, c66e344e-libxl-dont-deref-NULL.patch bsc#1080957 OBS-URL: https://build.opensuse.org/request/show/589839 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=681
61 lines
2.0 KiB
Diff
61 lines
2.0 KiB
Diff
commit fe51dbda56b5e51e17b238210a19e3c9887a3f15
|
|
Author: John Ferlan <jferlan@redhat.com>
|
|
Date: Fri Mar 9 11:48:00 2018 -0500
|
|
|
|
libxl: Use virDomainObjListFindBy{UUID|ID}Ref
|
|
|
|
For libxlDomainLookupByID and libxlDomainLookupByUUID let's
|
|
return a locked and referenced @vm object so that callers can
|
|
then use the common and more consistent virDomainObjEndAPI in
|
|
order to handle cleanup rather than needing to know that the
|
|
returned object is locked and calling virObjectUnlock.
|
|
|
|
The LookupByName already returns the ref counted and locked object,
|
|
so this will make things more consistent.
|
|
|
|
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
|
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
|
|
|
|
Index: libvirt-4.1.0/src/libxl/libxl_driver.c
|
|
===================================================================
|
|
--- libvirt-4.1.0.orig/src/libxl/libxl_driver.c
|
|
+++ libvirt-4.1.0/src/libxl/libxl_driver.c
|
|
@@ -1090,7 +1090,7 @@ libxlDomainLookupByID(virConnectPtr conn
|
|
virDomainObjPtr vm;
|
|
virDomainPtr dom = NULL;
|
|
|
|
- vm = virDomainObjListFindByID(driver->domains, id);
|
|
+ vm = virDomainObjListFindByIDRef(driver->domains, id);
|
|
if (!vm) {
|
|
virReportError(VIR_ERR_NO_DOMAIN, NULL);
|
|
goto cleanup;
|
|
@@ -1102,8 +1102,7 @@ libxlDomainLookupByID(virConnectPtr conn
|
|
dom = virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id);
|
|
|
|
cleanup:
|
|
- if (vm)
|
|
- virObjectUnlock(vm);
|
|
+ virDomainObjEndAPI(&vm);
|
|
return dom;
|
|
}
|
|
|
|
@@ -1114,7 +1113,7 @@ libxlDomainLookupByUUID(virConnectPtr co
|
|
virDomainObjPtr vm;
|
|
virDomainPtr dom = NULL;
|
|
|
|
- vm = virDomainObjListFindByUUID(driver->domains, uuid);
|
|
+ vm = virDomainObjListFindByUUIDRef(driver->domains, uuid);
|
|
if (!vm) {
|
|
virReportError(VIR_ERR_NO_DOMAIN, NULL);
|
|
goto cleanup;
|
|
@@ -1126,8 +1125,7 @@ libxlDomainLookupByUUID(virConnectPtr co
|
|
dom = virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id);
|
|
|
|
cleanup:
|
|
- if (vm)
|
|
- virObjectUnlock(vm);
|
|
+ virDomainObjEndAPI(&vm);
|
|
return dom;
|
|
}
|
|
|