mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
qemu: clean up migration ports when migration cancelled
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>
This commit is contained in:
parent
b4e0299d4f
commit
c92ca769af
@ -4387,12 +4387,16 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
|
|||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||||
virCapsPtr caps = NULL;
|
virCapsPtr caps = NULL;
|
||||||
|
unsigned short port;
|
||||||
|
|
||||||
VIR_DEBUG("driver=%p, dconn=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
|
VIR_DEBUG("driver=%p, dconn=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
|
||||||
"cookieout=%p, cookieoutlen=%p, flags=%lx, retcode=%d",
|
"cookieout=%p, cookieoutlen=%p, flags=%lx, retcode=%d",
|
||||||
driver, dconn, vm, NULLSTR(cookiein), cookieinlen,
|
driver, dconn, vm, NULLSTR(cookiein), cookieinlen,
|
||||||
cookieout, cookieoutlen, flags, retcode);
|
cookieout, cookieoutlen, flags, retcode);
|
||||||
|
|
||||||
|
port = priv->migrationPort;
|
||||||
|
priv->migrationPort = 0;
|
||||||
|
|
||||||
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
|
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -4439,8 +4443,6 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
qemuMigrationStopNBDServer(driver, vm, mig);
|
qemuMigrationStopNBDServer(driver, vm, mig);
|
||||||
virPortAllocatorRelease(driver->migrationPorts, priv->migrationPort);
|
|
||||||
priv->migrationPort = 0;
|
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_PERSIST_DEST) {
|
if (flags & VIR_MIGRATE_PERSIST_DEST) {
|
||||||
virDomainDefPtr vmdef;
|
virDomainDefPtr vmdef;
|
||||||
@ -4573,6 +4575,7 @@ endjob:
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
virPortAllocatorRelease(driver->migrationPorts, port);
|
||||||
if (vm) {
|
if (vm) {
|
||||||
VIR_FREE(priv->origname);
|
VIR_FREE(priv->origname);
|
||||||
virObjectUnlock(vm);
|
virObjectUnlock(vm);
|
||||||
|
Loading…
Reference in New Issue
Block a user