mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
qemu_migration: Stop NBD server at Finish phase
At the end of migration, it is important to stop NBD server and thus release all allocated resources.
This commit is contained in:
parent
7b7600b3e6
commit
ae21b9bde6
@ -1328,6 +1328,30 @@ error:
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
qemuMigrationStopNBDServer(virQEMUDriverPtr driver,
|
||||||
|
virDomainObjPtr vm,
|
||||||
|
qemuMigrationCookiePtr mig)
|
||||||
|
{
|
||||||
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
|
|
||||||
|
if (!mig->nbd)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (qemuDomainObjEnterMonitorAsync(driver, vm,
|
||||||
|
QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (qemuMonitorNBDServerStop(priv->mon) < 0)
|
||||||
|
VIR_WARN("Unable to stop NBD server");
|
||||||
|
|
||||||
|
qemuDomainObjExitMonitor(driver, vm);
|
||||||
|
|
||||||
|
virPortAllocatorRelease(driver->remotePorts, priv->nbdPort);
|
||||||
|
priv->nbdPort = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Validate whether the domain is safe to migrate. If vm is NULL,
|
/* Validate whether the domain is safe to migrate. If vm is NULL,
|
||||||
* then this is being run in the v2 Prepare stage on the destination
|
* then this is being run in the v2 Prepare stage on the destination
|
||||||
* (where we only have the target xml); if vm is provided, then this
|
* (where we only have the target xml); if vm is provided, then this
|
||||||
@ -3803,6 +3827,8 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
|
|||||||
VIR_WARN("unable to provide network data for relocation");
|
VIR_WARN("unable to provide network data for relocation");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qemuMigrationStopNBDServer(driver, vm, mig);
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_PERSIST_DEST) {
|
if (flags & VIR_MIGRATE_PERSIST_DEST) {
|
||||||
virDomainDefPtr vmdef;
|
virDomainDefPtr vmdef;
|
||||||
if (vm->persistent)
|
if (vm->persistent)
|
||||||
|
Loading…
Reference in New Issue
Block a user