SHA256
1
0
forked from pool/libvirt
libvirt/60b3fcd9-libxl-MigratePrepare.patch
James Fehlig 1ea77165a0 Accepting request 589839 from home:jfehlig:branches:Virtualization
- 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
2018-03-22 00:33:49 +00:00

75 lines
2.2 KiB
Diff

commit 60b3fcd90cbd83e5721484d72414dfee1706dab8
Author: Jim Fehlig <jfehlig@suse.com>
Date: Tue Mar 13 10:48:28 2018 -0600
libxl: MigratePrepare: use standard begin and end API pattern
libxlDomainMigrationPrepare adds the incoming domain def to the list
of domains via virDomainObjListAdd, but never adds its own ref to the
returned virDomainObj as other callers of virDomainObjListAdd do.
libxlDomainMigrationPrepareTunnel3 suffers the same discrepancy.
Change both to add a ref to the virDomainObj after a successful
virDomainObjListAdd, similar to other callers. This ensures a consistent
pattern throughout the drivers and allows using the virDomainObjEndAPI
function for cleanup.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
Index: libvirt-4.1.0/src/libxl/libxl_migration.c
===================================================================
--- libvirt-4.1.0.orig/src/libxl/libxl_migration.c
+++ libvirt-4.1.0/src/libxl/libxl_migration.c
@@ -583,6 +583,7 @@ libxlDomainMigrationPrepareTunnel3(virCo
NULL)))
goto error;
+ virObjectRef(vm);
*def = NULL;
priv = vm->privateData;
@@ -635,13 +636,11 @@ libxlDomainMigrationPrepareTunnel3(virCo
/* Remove virDomainObj from domain list */
if (vm) {
virDomainObjListRemove(driver->domains, vm);
- vm = NULL;
+ virObjectLock(vm);
}
done:
- if (vm)
- virObjectUnlock(vm);
-
+ virDomainObjEndAPI(&vm);
return ret;
}
@@ -683,6 +682,7 @@ libxlDomainMigrationPrepare(virConnectPt
NULL)))
goto error;
+ virObjectRef(vm);
*def = NULL;
priv = vm->privateData;
@@ -810,7 +810,7 @@ libxlDomainMigrationPrepare(virConnectPt
/* Remove virDomainObj from domain list */
if (vm) {
virDomainObjListRemove(driver->domains, vm);
- vm = NULL;
+ virObjectLock(vm);
}
done:
@@ -820,8 +820,7 @@ libxlDomainMigrationPrepare(virConnectPt
VIR_FREE(hostname);
else
virURIFree(uri);
- if (vm)
- virObjectUnlock(vm);
+ virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
return ret;
}