[PATCH V2 3/3] libxl: acquire a job when receiving a migrating domain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit f86ae403 moved acquiring a job from libxlDomainStart()
to its callers. One spot missed was in libxlDoMigrateReceive().
Acquire a job in libxlDoMigrateReceive() before calling
libxlDomainStart().

Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
---
 src/libxl/libxl_migration.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index a407ad9..8db3aea 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -95,17 +95,20 @@ libxlDoMigrateReceive(void *opaque)
     int recvfd = args->recvfd;
     size_t i;
     int ret;
+    bool remove_dom = 0;
+
+    virObjectLock(vm);
+    if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
+        goto cleanup;
 
     /*
      * Always start the domain paused.  If needed, unpause in the
      * finish phase, after transfer of the domain is complete.
      */
-    virObjectLock(vm);
     ret = libxlDomainStart(driver, vm, true, recvfd);
-    virObjectUnlock(vm);
 
     if (ret < 0 && !vm->persistent)
-        virDomainObjListRemove(driver->domains, vm);
+        remove_dom = true;
 
     /* Remove all listen socks from event handler, and close them. */
     for (i = 0; i < nsocks; i++) {
@@ -117,6 +120,17 @@ libxlDoMigrateReceive(void *opaque)
     args->nsocks = 0;
     VIR_FORCE_CLOSE(recvfd);
     virObjectUnref(args);
+
+    if (!libxlDomainObjEndJob(driver, vm))
+        vm = NULL;
+
+ cleanup:
+    if (remove_dom && vm) {
+        virDomainObjListRemove(driver->domains, vm);
+        vm = NULL;
+    }
+    if (vm)
+        virObjectUnlock(vm);
 }
 
 
-- 
2.3.7

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]