]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: clean up migration ports when migration cancelled
authorZeng Junliang <zengjunliang@huawei.com>
Wed, 6 Nov 2013 03:36:57 +0000 (11:36 +0800)
committerJán Tomko <jtomko@redhat.com>
Thu, 9 Jan 2014 13:25:35 +0000 (14:25 +0100)
If there's a migration cancelled, the bitmap of migration port should be
cleaned up too.

Signed-off-by: Zeng Junliang <zengjunliang@huawei.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit c92ca769af2bacefdd451802d7eb1adac5e6597c)

src/qemu/qemu_migration.c

index 7d96d17f91ed88fe94c7c930ed4826a11582c9e9..e8dd367dd471786df82c619fd95d91c7f6cec9c5 100644 (file)
@@ -3930,12 +3930,16 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
     qemuDomainObjPrivatePtr priv = vm->privateData;
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
     virCapsPtr caps = NULL;
+    unsigned short port;
 
     VIR_DEBUG("driver=%p, dconn=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
               "cookieout=%p, cookieoutlen=%p, flags=%lx, retcode=%d",
               driver, dconn, vm, NULLSTR(cookiein), cookieinlen,
               cookieout, cookieoutlen, flags, retcode);
 
+    port = priv->migrationPort;
+    priv->migrationPort = 0;
+
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
         goto cleanup;
 
@@ -3982,8 +3986,6 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
         }
 
         qemuMigrationStopNBDServer(driver, vm, mig);
-        virPortAllocatorRelease(driver->migrationPorts, priv->migrationPort);
-        priv->migrationPort = 0;
 
         if (flags & VIR_MIGRATE_PERSIST_DEST) {
             virDomainDefPtr vmdef;
@@ -4116,6 +4118,7 @@ endjob:
     }
 
 cleanup:
+    virPortAllocatorRelease(driver->migrationPorts, port);
     if (vm) {
         VIR_FREE(priv->origname);
         virObjectUnlock(vm);