mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 07:42:56 +00:00
qemu: migration: Refresh device information after transferring state
In my first approach in 4b480d10768c I overlooked the comment in qemuMigrationRunIncoming stating that during actual migration the qemuMigrationRunIncoming does not wait until the migration is complete but rather offloads that to the Finish phase of migration. This means that during actual migration qemuProcessRefreshState was called prior to qemu actually transferring the full state and thus the queries did not get the correct information. The approach worked only for restore, where we wait for the migration to finish during qemu startup. Fix the issue by calling qemuProcessRefreshState both from qemuProcessStart if there's no incomming migration and from qemuMigrationFinish so that the code actually works as expected.
This commit is contained in:
parent
038eb472a0
commit
93db7eea1b
@ -5373,6 +5373,15 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
|
|||||||
goto endjob;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Now that the state data was transferred we can refresh the actual state
|
||||||
|
* of the devices */
|
||||||
|
if (qemuProcessRefreshState(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN) < 0) {
|
||||||
|
/* Similarly to the case above v2 protocol will not be able to recover
|
||||||
|
* from this. Let's ignore this and perhaps stuff will not break. */
|
||||||
|
if (v3proto)
|
||||||
|
goto endjob;
|
||||||
|
}
|
||||||
|
|
||||||
if (priv->job.current->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY)
|
if (priv->job.current->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY)
|
||||||
inPostCopy = true;
|
inPostCopy = true;
|
||||||
|
|
||||||
|
@ -6084,7 +6084,7 @@ qemuProcessLaunch(virConnectPtr conn,
|
|||||||
* function is called after a deferred migration finishes so that we can update
|
* function is called after a deferred migration finishes so that we can update
|
||||||
* state influenced by the migration stream.
|
* state influenced by the migration stream.
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
qemuProcessRefreshState(virQEMUDriverPtr driver,
|
qemuProcessRefreshState(virQEMUDriverPtr driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
qemuDomainAsyncJob asyncJob)
|
qemuDomainAsyncJob asyncJob)
|
||||||
@ -6125,9 +6125,6 @@ qemuProcessFinishStartup(virConnectPtr conn,
|
|||||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (qemuProcessRefreshState(driver, vm, asyncJob) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (startCPUs) {
|
if (startCPUs) {
|
||||||
VIR_DEBUG("Starting domain CPUs");
|
VIR_DEBUG("Starting domain CPUs");
|
||||||
if (qemuProcessStartCPUs(driver, vm, conn,
|
if (qemuProcessStartCPUs(driver, vm, conn,
|
||||||
@ -6231,11 +6228,17 @@ qemuProcessStart(virConnectPtr conn,
|
|||||||
VIR_DOMAIN_PAUSED_USER) < 0)
|
VIR_DOMAIN_PAUSED_USER) < 0)
|
||||||
goto stop;
|
goto stop;
|
||||||
|
|
||||||
|
if (!incoming) {
|
||||||
/* Keep watching qemu log for errors during incoming migration, otherwise
|
/* Keep watching qemu log for errors during incoming migration, otherwise
|
||||||
* unset reporting errors from qemu log. */
|
* unset reporting errors from qemu log. */
|
||||||
if (!incoming)
|
|
||||||
qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL);
|
qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
/* Refresh state of devices from qemu. During migration this needs to
|
||||||
|
* happen after the state information is fully transferred. */
|
||||||
|
if (qemuProcessRefreshState(driver, vm, asyncJob) < 0)
|
||||||
|
goto stop;
|
||||||
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -129,6 +129,10 @@ int qemuProcessFinishStartup(virConnectPtr conn,
|
|||||||
bool startCPUs,
|
bool startCPUs,
|
||||||
virDomainPausedReason pausedReason);
|
virDomainPausedReason pausedReason);
|
||||||
|
|
||||||
|
int qemuProcessRefreshState(virQEMUDriverPtr driver,
|
||||||
|
virDomainObjPtr vm,
|
||||||
|
qemuDomainAsyncJob asyncJob);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
VIR_QEMU_PROCESS_STOP_MIGRATED = 1 << 0,
|
VIR_QEMU_PROCESS_STOP_MIGRATED = 1 << 0,
|
||||||
VIR_QEMU_PROCESS_STOP_NO_RELABEL = 1 << 1,
|
VIR_QEMU_PROCESS_STOP_NO_RELABEL = 1 << 1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user