[libvirt] [PATCH 2/7] qemu: Properly update completed migration stats
Jiri Denemark
jdenemar at redhat.com
Thu Feb 25 15:13:44 UTC 2016
On Tue, Feb 23, 2016 at 16:41:41 +0100, Jiri Denemark wrote:
> We should not overwrite all migration statistics on the source with the
> numbers sent by the destination since the source may have an updated
> view in some cases (such as post-copy migration). It's safer to update
> just the timing info we need to get from the destination and be prepared
> for the future. And we should only do all this after a successful
> migration.
>
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
> src/qemu/qemu_migration.c | 18 +++++++++++++-----
> 1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 97e98bb..e6895df 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
...
> @@ -3884,12 +3886,18 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
> QEMU_MIGRATION_COOKIE_STATS)))
> goto cleanup;
>
> - /* Update total times with the values sent by the destination daemon */
> - if (mig->jobInfo) {
> - qemuDomainObjPrivatePtr priv = vm->privateData;
> + /* Update times with the values sent by the destination daemon */
> + if (retcode == 0)
> + jobInfo = priv->job.completed;
> + else
> VIR_FREE(priv->job.completed);
> - priv->job.completed = mig->jobInfo;
> - mig->jobInfo = NULL;
> + if (mig->jobInfo && jobInfo) {
> + jobInfo->type = mig->jobInfo->type;
> + qemuDomainJobInfoUpdateTime(jobInfo);
> + jobInfo->timeDeltaSet = mig->jobInfo->timeDeltaSet;
> + jobInfo->timeDelta = mig->jobInfo->timeDelta;
> + jobInfo->stats.downtime_set = mig->jobInfo->stats.downtime_set;
> + jobInfo->stats.downtime = mig->jobInfo->stats.downtime;
> }
>
> if (flags & VIR_MIGRATE_OFFLINE)
Consider the following patch squashed in:
diff --git i/src/qemu/qemu_migration.c w/src/qemu/qemu_migration.c
index e6895df..d587bb6 100644
--- i/src/qemu/qemu_migration.c
+++ w/src/qemu/qemu_migration.c
@@ -3886,13 +3886,13 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
QEMU_MIGRATION_COOKIE_STATS)))
goto cleanup;
- /* Update times with the values sent by the destination daemon */
if (retcode == 0)
jobInfo = priv->job.completed;
else
VIR_FREE(priv->job.completed);
+
+ /* Update times with the values sent by the destination daemon */
if (mig->jobInfo && jobInfo) {
- jobInfo->type = mig->jobInfo->type;
qemuDomainJobInfoUpdateTime(jobInfo);
jobInfo->timeDeltaSet = mig->jobInfo->timeDeltaSet;
jobInfo->timeDelta = mig->jobInfo->timeDelta;
More information about the libvir-list
mailing list